Usually validation is simply the case of dragging one of the excellent validation controls onto the page and pointing it towards the control you wish to validate.
Custom User Control's however are a different story.
Recently I stumbled across the problem of needing to validate user input supplied to a Custom User Control.
The Page_Load event handler creates a new Guid using Guid. It then sets the Validation Group property of Button1, Text Box1 and Required Field Validaror1 to this Guid string.
He gives me article User Control must not be in the root directory of the project.
I am using a usercontrol which has two textboxes named txt User Name,txt Password and a button named btn Submit. I want to show alert message in the webpage if the user didnot enter the username or password .
when the page is validated the content of the UC should also be validated.
Check Control Validation Property(String name, String property Name) at System.
Net web user control that contains a Text Box and a calendar from the Ajax Control Toolkit.
In the second approach outlined above you can auto-generate Validation Group value inside the user control itself.
The following code shows how: The above code shows the Page_Load event handler of the user control.