Friday 18 October 2013

Ajax modal popup extender and Validation summary "Object Expected" error

Hi all, if you use ajax modal popup extender and asp validation summary you will notice an issue  "Object Expected" javascript error.

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

Inherit the above class in aspx pages like
<%@ Register Assembly="TestAssembly" Namespace="TestName" TagPrefix="cc1" %>

Now use cc1 instead of asp 
ex: <cc1:AjaxValidationSummary id="" runat="server" />

No comments:

Post a Comment