Validating in a web user control consolidatingdebt com

Rated 3.94/5 based on 734 customer reviews

There is no performance difference, but when declaring User Controls in the web.config file, the controls have to reside in a different directory than the page(s) using it. Add the following line below the standard page declaration: If you look at the page now, you will see our User Control in action, although the information will be a bit... We will have to set a value for the properties we defined, for things to get just a bit more interestingly.Fortunately, it's very easy: You see, every public or protected member can be accessed declaretively, allowing easy access to them when we use our control.The following code shows how: The above code shows the Page_Load event handler of the user control.

Okay, so we will be building a User Control for displaying information about a community user.

Now the individual user controls will work as expected.

In the second approach outlined above you can auto-generate Validation Group value inside the user control itself.

If there's no logical control on your page to add it to, you may create one for the purpose - the Place Holder control is for situations just like that.

On your page, define it like this: We use the Load Control method to instantiate the User Control by specifying the path. On the page, add the following declaration in the top: Now we can access the User Info Box Control class like if it were a regular class, which also means that we can typecast the User Control returned by the Load Control method to this type.

Leave a Reply