Asp.Net MVC model validation with default text in textbox -
I am trying to validate the input control in ASP.Net MVC. Check the code given below if the project name is zero and throws verification. I'll get some default text in the textbox on page load. I have a scenario to see that the name of the project is not empty and the name of the project is not a "test project" can I do in a similar scenario? [Required (error message = "Choose project name."]] [DisplayName ("Project type:")] Public string SelectedProjectName {get} set;}
< This is an example. Div class = "post-text" itemprop = "text">
You can write your own custom carrier.
Public class ProjectNameValidation: ValidationAttribute {Public ProjectNameValidation ( } {} / / / Private const string error msg = "{0} should not be greater than {1} or {2}; Public override button ISYID (object value) {if (value ! = Null & value! = "Test project") {return true;} description is false;}}
Comments
Post a Comment