x

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed

Wednesday, April 11, 20120 comments


Introduction:I got this runtime error while working with AJAX in asp.net. The error message is:
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.
Description:
I got this runtime error "Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException:
 The message received from the server could not be parsed." while doing one ajax operation in visualstudio 2010. You can also check the figure below.

What i exactly did is i placed one button inside the update panel within <ContentTemplate> </ContentTemplate>.
Then while debugging after clicking on the button i got the error.My code was like below.
 <form id="form1" runat="server">
   <asp:ScriptManager ID="ScriptManager1" runat="server">
   </asp:ScriptManager>
   <div>
       <asp:UpdatePanel ID="UpdatePanel1" runat="server">
       <ContentTemplate>
            <asp:Button ID="btnCheck" runat="server" Text="Check"
               onclick="btnCheck_Click" />
           <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
           <ProgressTemplate>
           Processing plz wait..............
           </ProgressTemplate>
           </asp:UpdateProgress>
       </ContentTemplate>
 </asp:UpdatePanel>
   </div>
   </form>
Then i found two solutions. The solutions are like below:

1-Move the button outside of the UpdatePanel.
  OR
2-Register the button using <asp:PostBackTrigger>
I done with the second solution like i add one peace of code after </ContentTemplate> within the updatepanel.like below
 </ContentTemplate>
        <Triggers>
       <asp:PostBackTrigger ControlID="btnCheck" />
   </Triggers>
So now my full code looks like below
 <form id="form1" runat="server">
   <asp:ScriptManager ID="ScriptManager1" runat="server">
   </asp:ScriptManager>
   <div>
       <asp:UpdatePanel ID="UpdatePanel1" runat="server">
       <ContentTemplate>
            <asp:Button ID="btnCheck" runat="server" Text="Check"
               onclick="btnCheck_Click" />
           <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
           <ProgressTemplate>
           Processing plz wait..............
           </ProgressTemplate>
           </asp:UpdateProgress>
       </ContentTemplate>
        <Triggers>
       <asp:PostBackTrigger ControlID="btnCheck" />
   </Triggers>
    </asp:UpdatePanel>
   </div>
so in ths way i did this using the second solution.
Share this article :

Post a Comment

 
Copyright © 2010. SharePointDotNet.com - All Rights Reserved
Template Created by Creating Website Published by Mas Template