javascriptasp.netvalidationsummary

ValidationSummary javascript error


I'm getting an error on this line of javascript in IE8. It doesn't happen when the ValidationSummary is commented out. I believe this is the code that is generated by the control.

The ValidationSummary is on a UserControl that is used in a content page in asp.net.

When I use the IE developer tools it highlights this code

document.getElementById('ctl00_ctl00_body_pageBody_ucCC1_valSummary').dispose = function() {
    Array.remove(Page_ValidationSummaries, document.getElementById('ctl00_ctl00_body_pageBody_ucCC1_valSummary'));
}
(function() {var fn = function() {Sys.Extended.UI.ModalPopupBehavior.invokeViaServer('ctl00_ctl00_body_pageBody_mdlPopupExtender', true); Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);})()




<asp:ValidationSummary 
runat="server" 
ID="valSummary" 
ShowSummary="true" 
DisplayMode="BulletList"
CssClass="summaryValidation" 
HeaderText="Errors:" 
ForeColor="White" 
ValidationGroup="VldGrpHospital" />

Solution

  • Turns out this is a known bug in the ajax control toolkit. They claim it's been fixed in the latest release, but I don't think it has. The fix is to create a server control that inherits from the validation summary and inserts the one missing semi-colon between the two javascript statements.

    http://ajaxcontroltoolkit.codeplex.com/workitem/27024

    [ToolboxData("")]
    public class AjaxValidationSummary : ValidationSummary
    {
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), this.ClientID, ";", true);
        }
    }