private string _SelectedValue; public DropDownValidation(string selectedValue) { _SelectedValue = selectedValue; } public override ValidationResult IsValid(object value, ValidationContext validationContext) { if (value != null) { if (_SelectedValue == "----Select Country----") { return new ValidationResult("Select Some Country Please."); } else if (_SelectedValue == "----Select State----") { return new ValidationResult("Select Some State Please."); } else if (_SelectedValue == "----Select City----") { return new ValidationResult("Select Some City Please"); } } return ValidationResult.Success; }
Error 1 'ddl.Common.DropDownValidation.IsValid(object, System.ComponentModel.DataAnnotations.ValidationContext)': cannot change access modifiers when overriding 'protected' inherited member 'System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(object, System.ComponentModel.DataAnnotations.ValidationContext)'
if ddl.selectedvalue = "-----Select Country-----" then ScriptManager.RegisterStartupScript(Me.Page, Me.Page.[GetType](), "showalert", "alert('Please Select A Country!');", True) else end if
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)