Follow by Email

Tuesday, April 30, 2013

[Resolved] JavaScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException

1. This below error occurs when your controls like button, image button etc is under the Ajax update panel and is not registered for postback.

2. In my case this issue gets generated on the button click which is inside the gridview <ItemTemplate> field. Hence OnPreRender property of the button i will call a codebehind method so as to register the button control  for postback.

    <asp:Button ID="Button1" runat="server" OnPreRender="RegisterButton_PreRender" Text="Button" />

3. Below is the method which i will call OnPreRender

protected void RegisterButton_PreRender(object sender, EventArgs e)
        if (sender is Button)
            Button MyButton = (Button)sender;