Validating in a web user control
If you set the Validation Group property of Text Box1, Required Field Validator1 and Button1 to some string (say VG) and then run the Web Form you will find that upon clicking any of the Submit buttons both the Required Field Validatior controls show the error.This behavior is undesirable and causes due to the fact that both the instances of the user control use the same Validation Group value.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. 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.
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.
Is there a work-around for this scenario other than manually calling Page.
You will see only one line of code, the User Control declaration.
As mentioned, this control will be displaying information about a user, so let's get started adding some markup to do so: As you can see, it's all very basic.