470,572 Members | 2,094 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,572 developers. It's quick & easy.

Does .Net allow a ValidationSummary control to be added from code?

I'm trying to add a ValidationSummary control to a common base page used by
all of our system's aspx/ascx files. The base page is a regular class file
that inherits from System.Web.UI.Page. When I debug the application and click
the submit button with a data element that fails a validation, I get the
correct ValidationSummary messageBox, but I then receive the following error
in WebUIValidation.js ValidationSummaryOnSubmit():

Microsoft JScript runtime error: 'style' is null or not an object.

The line that causes the error is: summary.style.display = "none";

I didn't think the ValidationSummary class had a style attribute, but this
same line of code does not cause an error if I add the ValidationSummary
directly to the aspx/ascx page by dragging it from the Toolbox.

In the base page, the following code adds the ValidationSummary control:

System.Web.UI.WebControls.ValidationSummary validationSummary1;
validationSummary1 = new System.Web.UI.WebControls.ValidationSummary();
validationSummary1.ID = "validationSummary1";
validationSummary1.ShowMessageBox = true;
validationSummary1.ShowSummary = true;

Any help would be much appreciated!

Nov 22 '05 #1
0 1369

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by John Mabbott | last post: by
reply views Thread by Mr. x | last post: by
2 posts views Thread by Sunil Sabir | last post: by
5 posts views Thread by john.livermore | last post: by
2 posts views Thread by Code Rodent | last post: by
1 post views Thread by livre | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.