Initially when you create the validator control you need not specify the "control to validate". Once you create a control (textbox, checkbox) then you can in the C# code specify the control to validate property. RequiredFieldValidator1.ControlToValidate = "TextBox1";
Hope this helps -----Original Message----- From: moron_psychomaniac [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:32 PM To: [EMAIL PROTECTED] Subject: [AspNetAnyQuestionIsOk] Validator for dynamically created control I have just created a dynamic ASP.NET form. The fields and its type (textbox, checkbox, radiobutton, etc) are controlled through the SQL database. Now I want to validate user-input by using the validator provided by ASP.NET. However, I can't really do it because all my controls (textbox, checkbox, etc) are created dynamically. Here's a sample to the code for validator: <asp:RequiredFieldValidator id="valRequired" runat="server" ControlToValidate="textbox1" ErrorMessage="* You must enter a value into textbox1" Display="dynamic">* </asp:RequiredFieldValidator> Notice that it has a field "ControlToValidate". It means I have to specify the name of the control to be validated even before the control itself is even created. Anybody has a suggestion? Thanks a lot! Yahoo! Groups Sponsor ADVERTISEMENT <http://us.ard.yahoo.com/SIG=129es87p2/M=298184.5285298.6392945.3001176/D=gr oups/S=1705006764:HM/EXP=1095411739/A=2352667/R=0/SIG=11t4iivpf/*http://www. netflix.com/Default?mqso=60185359&partid=5285298> click here <http://us.adserver.yahoo.com/l?M=298184.5285298.6392945.3001176/D=groups/S= :HM/A=2352667/rand=359831111> _____ Yahoo! Groups Links * To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/> * To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED] e> * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service <http://docs.yahoo.com/info/terms/> . ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ********************************************************************** [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar. Now with Pop-Up Blocker. Get it for free! http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
