Start Free Trial
Come for the solution, stay for everything else.
Start Free Trial
Dynamically added RangeValidatorm not working
I am working in asp.net using c#
I have added RangeValidator dynamically, but it is not working. Can you please help me whay my dynamic validator is not working
I have added textbox and validator dynamically and I can see dynamic textbox on my screen from below code
hcell = new HtmlTableCell();
hcell.VAlign = "top";
TextBox txtUnitCost = new TextBox();
txtUnitCost.ID = "txtUnitCost" + Convert.ToString(cnt);
txtUnitCost.CssClass = "formTextTender";
RangeValidator rgvUnitCost = new RangeValidator();
p = "tenderSubmit";
rgvUnitCost.ID = "rgvUnitCost" + Convert.ToString(cnt);
rgvUnitCost.Type = ValidationDataType.Double;
ate = "txtUnitCost" + Convert.ToString(cnt);
rgvUnitCost.ErrorMessage = "Please enter valid unit cost " + Convert.ToString(cnt);
rgvUnitCost.Display = ValidatorDisplay.None;
r = true;
rgvUnitCost.Visible = true;
ript = true;
rgvUnitCost.Enabled = true;
Below is the text field whose validator works and this is not dynamic
<asp:TextBox ID="txtAddress1" runat="server" CssClass="formText"></asp:
2" runat="server" ControlToValidate="txtAddr
ErrorMessage="Address1 field cannot be blank" ValidationGroup="tenderSub
mit" Display="None" SetFocusOnError="True"></a
Below is my validator summary added in aspx page
<asp:ValidationSummary ID="ValidationSummary1" runat="server"
HeaderText="You must enter a value in the following fields:" ShowMessageBox="True"
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Log in or sign up to see answer
Become an EE member today
7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
Plans and Pricing
Certified Expert Program
© 1996-2022 Experts Exchange, LLC. All rights reserved. Covered by US Patent