Validating in a web user control
We have a declaration, some standard tags, some text, and then we have some sort of variables. Well, right now, they come from nowhere, since we haven't declared them yet. Open the Code Behind file for the User Control, that is, the one which ends on
As you can see, it looks just like a Code Behind file for a regular page, except that it inherits from User Control instead of from Page.
This is very easy, but also very anonymous - because we just use the Load Control method, we can't really use our own, custom properties. In the next example, we do just that, then we set the properties, and at last, we add it to the Place Holder: User Info Box Control user Info Box Control = (User Info Box Control)Load Control("~/User Info Box Control.ascx"); user Info Box Control.
Okay, so we will be building a User Control for displaying information about a community user.
The first thing we have to do, is declare our User Control.
It can be done either in each page where it's used, or globally in the web.config file.
You should now have a User Info Box and a User Info Box cs in your project.A dialog will pop up, and you should select the Web User Control from the list of possible things to add.Let's call our User Control User Info Box Control, with the filename of User Info Box A User Control can't be displayed directly in the browser - it has to be included on a page. Hi, I have a user control which has some server controls like drop down list, list box etc. I'm using this control in a parent page which has its own server controls which are also required. NET 1.1 (VS 2003) Thanks a lot Kiran The button on the parent page which is supposed to validate the controls is not working after I add the web user control.
Search for validating in a web user control:
Now the individual user controls will work as expected.