Add validation to WebUserControl, Normally when we click on ControlToVelidate property, it automatically show as all the list of WebControls of that from, But you will not find WebUserControl name there.
Solution is that just write down that WebUserControl name and type "
$" sign and write down WebControl name which one is going to validate form that WebUserControl.
for example:
- I created a webusercontrol and there is a textbox in that control.
- I will drag that webusercontrol in my aspx page.
- It's default name will be "WebUserControl1"
- Now I will put a RequiredFieldValidator in my aspx page.
- Then I will write down in ControlToVelidate = "WebUserControl1$TextBox1"
Because "WebUserControl1" is my web control name in my aspx page. and "TextBox1" this the name of that control in that Web User Control.
This is very ease and useful method to validate WebUserControl.