Facebook
Twitter
Pinterest
Tumblr
GitHub
RSS
  • DEV Home
  • Documentation
  • Reference
  • Download
Search Results for

    Show / Hide Table of Contents

    Features: Validation

    Validation can be performed at the server side by overriding the Validate method. When validation is unsuccessful, you can add a ValidationError to the list with an appropriate message, which will be shown at the client as a message box.

    [DisplayName("Number 1")]
    [Description("This number must be greater than Number 2.")]
    public int Number1 { get; set; } = 10;
    
    [DisplayName("Number 2")]
    [Description("Try setting this to a value >= Number 1 and save.")]
    public int Number2 { get; set; } = 5;
    
    protected override void Validate(IEditObjectContainer container, ValidationErrorList errorList)
    {
        if (this.Number1 <= this.Number2)
        {
            ValidationError error = this.CreateValidationError(container, nameof(this.Number1), "Number 1 must be greater than Number 2!");
            errorList.Add(error);
        }
    }
    
    SDK
    On this Page
    Back to Top Copyright 2022 © EMBY LLC. Please see our terms of use and privacy policy.