Home > DeveloperSection > Forums > Validate ASP.NET Controls
Carl Pieterson
Carl Pieterson

Total Post:14

Points:98
Posted on    November-30-2011 12:11 AM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 1375  View(s)
Rate this:

Here I just want to ask,

How to validate asp.net controls dynamically using validation controls such as RequiredFieldValidator etc. of asp.net

Thanks in advance.



Chris Anderson
Chris Anderson

Total Post:65

Points:455
Posted on    November-30-2011 12:15 AM

hi carl,

To validate the asp.net controls dynamically you can use the above code:

RequiredFieldValidator required = new RequiredFieldValidator(); //create object
required.ControlToValidate = "RadioButtonList1; //bind control
required.ErrorMessage = "Choose option"; //specify message
this.form1.Controls.Add(required); // add the control

Don't want to miss updates? Please click the below button!

Follow MindStick