Validating in a web user control
27-Aug-2020 08:56
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.The following code shows how: The above code shows the Page_Load event handler of the 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.To overcome this problem you can take two approaches: The first solution requires you to create a property (say Validation Group) in the user control.This property will accept a unique string value for Validation Group and will assign it to all the required server controls.
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.
The first is where we put our markup, and the second is our Code Behind file.