ASP.NET UserControl with validation

ecig3322

New Member
I need to create my UserControl with validation.I created UserControl:\[code\]<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyValidationControl.ascx.cs" Inherits="Labs.MyValidationControl" %> <asp:Label runat="server" ID="Name">Name</asp:Label> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Field ''Name'' is required." ControlToValidate="TextBox3" ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator> <br/> <asp:Label runat="server" ID="Password">Password</asp:Label><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:RangeValidator runat="server" MinimumValue="http://stackoverflow.com/questions/14455088/1" MaximumValue="http://stackoverflow.com/questions/14455088/10" Type="Integer" id="rngText" controltovalidate="TextBox2" ValidationGroup="LoginUserValidationGroup" errormessage="The value must be from 1 to 10!" /> <br />\[/code\]Then I use UserControl on the form:\[code\]<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent"> <asp:MyValidationControl runat="server"/></asp:Content>\[/code\]When I start my application I see nothing on this page.
 
Back
Top