Validation Summary isn't working...

S

Steve Nobody

I am creating a dynamic form with dynamic regular expression
validators...

RegularExpressionValidator oRV = new RegularExpressionValidator();


oRV.ID = "RV_" + oTB.ID;
oRV.ControlToValidate = oTB.ID;
oRV.ValidationExpression = "^\\d+$";
oRV.Display = ValidatorDisplay.Dynamic;
oRV.ErrorMessage = "Must be numeric.";
oRV.Text = "*";
oRV.ValidationGroup = "AnnualForm";
oRV.ForeColor = System.Drawing.Color.Red;
oRV.EnableClientScript = true;
oRV.EnableViewState = true;


oCell.Controls.Add(oRV);


and trying to use the following ValidationSummary....


<asp:ValidationSummary ID="ValSummary1" runat="server"
EnableClientScript="true" Enabled="true" ShowMessageBox="true"
ShowSummary="true" ValidationGroup="AnnualForm"
DisplayMode="BulletList" />


The "*" display by each textbox they are grouped with, but the
validationsummary does nothing. I have tried various display modes
and
still no change. I am using .net 2.0. Any suggestions?


Steve
 
A

Ananth Ramasamy Meenachi

Steve Nobody said:
I am creating a dynamic form with dynamic regular expression
validators...

RegularExpressionValidator oRV = new RegularExpressionValidator();


oRV.ID = "RV_" + oTB.ID;
oRV.ControlToValidate = oTB.ID;
oRV.ValidationExpression = "^\\d+$";
oRV.Display = ValidatorDisplay.Dynamic;
oRV.ErrorMessage = "Must be numeric.";
oRV.Text = "*";
oRV.ValidationGroup = "AnnualForm";
oRV.ForeColor = System.Drawing.Color.Red;
oRV.EnableClientScript = true;
oRV.EnableViewState = true;


oCell.Controls.Add(oRV);


and trying to use the following ValidationSummary....


<asp:ValidationSummary ID="ValSummary1" runat="server"
EnableClientScript="true" Enabled="true" ShowMessageBox="true"
ShowSummary="true" ValidationGroup="AnnualForm"
DisplayMode="BulletList" />


The "*" display by each textbox they are grouped with, but the
validationsummary does nothing. I have tried various display modes
and
still no change. I am using .net 2.0. Any suggestions?


Steve
 
A

Ananth Ramasamy Meenachi

You might be creating the validator in Page_Load and immediately attempting
to validate with it. Make sure you add the validator to the page, perhaps to
a PlaceHolder. Move your validation tests into the post back event handler
method (the Click event of the submit control). Then test Page.IsValid is
true.

Ananth Ramasamy Meenachi www.msarm.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top