Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is e

Aug 31, 2009 at 7:32 PM

Hi,

            I am using simple GridView with couple of buttong on each row(Render, Copy etc) inside the update panel. I am creating stream and pushing to client and i am getting the below error. Can you please help me to resolve this issue? Below are the error, html code and codebehind code.

Thanks
Ravi

 

Error:
 
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
 
 
 
HTML: 
 
<asp:UpdatePanel ID="pnlNewMission" runat="server">
     <ContentTemplate>
    <asp:GridView ID="grdTaskList" AllowSorting="True" runat="server"
     DataKeyNames="xId" CssClass="GridStyle" PagerStyle-BackColor="Bisque" BorderStyle="Dashed"
     BorderWidth="1px" CellPadding="2" AutoGenerateColumns="False" OnSorting="grdTaskList_Sorting"
     OnRowCommand="grdTaskList_RowCommand" OnRowDataBound="grdTaskList_RowDataBound"
     Width="95%" OnPreRender="grdTaskList_PreRender" OnRowCreated="grdTaskList_RowCreated">
     <PagerTemplate>
      <table>
       <tr>
        <td align="right">
         Page
         <asp:Label ID="PageNumberLabel" runat="server" />
         of
         <asp:Label ID="TotalPagesLabel" runat="server" />
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
         <asp:LinkButton ID="PreviousButton" Text="<" CommandName="Page" CommandArgument="Prev"
          runat="Server" />
         <asp:LinkButton ID="NextButton" Text=">" CommandName="Page" CommandArgument="Next"
          runat="Server" />
        </td>
       </tr>
      </table>
     </PagerTemplate>
     <Columns>
      <asp:TemplateField HeaderText="Priority" SortExpression="TaskPriority.Name" ItemStyle-Wrap="false">
       <ItemTemplate>
        <%#Eval("TaskPriority.Name")%>
       </ItemTemplate>
       <ItemStyle Wrap="False" Width="3%"></ItemStyle>
      </asp:TemplateField>
      <asp:TemplateField HeaderText="Status" SortExpression="MissionTaskStatus.Name" ItemStyle-Wrap="true"
       ItemStyle-Width="5%">
       <ItemTemplate>
        <%#Eval("MissionTaskStatus.Name")%>
       </ItemTemplate>
       <ItemStyle Wrap="False" Width="3%"></ItemStyle>
      </asp:TemplateField>
      <asp:BoundField DataField="CreatorFullName" HeaderText="Creator" ItemStyle-Wrap="false"
       SortExpression="CreatorFullName" ConvertEmptyStringToNull="False">
       <ControlStyle Width="3%" />
       <ItemStyle Width="3%" />
      </asp:BoundField>
      <asp:BoundField DataField="xCreatedDateTime" DataFormatString="{0:M-dd-yyyy}" HtmlEncode="false"
       ItemStyle-Wrap="false" HeaderText=" Date Created" SortExpression="xCreatedDateTime">
       <ControlStyle Width="3%" />
       <ItemStyle Width="3%" />
      </asp:BoundField>
      <asp:TemplateField HeaderText="AssignedTo" SortExpression="MissionTaskAssignedTo.Name"
       ItemStyle-Wrap="true" ItemStyle-Width="3%">
       <ItemTemplate>
        <%#Eval("MissionTaskAssignedTo.Name")%>
       </ItemTemplate>
       <ItemStyle Wrap="False" Width="3%"></ItemStyle>
      </asp:TemplateField>
      <asp:TemplateField HeaderText="Support To" SortExpression="TaskSupportType.Name"
       ItemStyle-Wrap="true" ItemStyle-Width="3%">
       <ItemTemplate>
        <%#Eval("TaskSupportType.Name")%>
       </ItemTemplate>
       <ItemStyle Wrap="False" Width="3%"></ItemStyle>
      </asp:TemplateField>
      <asp:BoundField DataField="TaskDescription" HeaderText="Description" SortExpression="TaskDescription">
       <ItemStyle Wrap="true" Width="85%" />
       <ControlStyle Width="85%" />
      </asp:BoundField>
      <asp:ButtonField Text="Edit" ItemStyle-ForeColor="Blue" ButtonType="Image" CommandName="Edit"
       ImageUrl="~/images/Style/bntTaskEdit.png">
       <ControlStyle Width="28px" />
       <ItemStyle ForeColor="Blue"></ItemStyle>
      </asp:ButtonField>
      <asp:TemplateField Visible="False">
       <ItemTemplate>
        <a style="color: Blue" href="javascript:PopUp('<%# Eval("xId")%>')">More</a>
       </ItemTemplate>
       <ControlStyle Width="2%" />
       <ItemStyle Width="2%" />
      </asp:TemplateField>
      <asp:ButtonField CommandName="Copy" Text="Copy" ItemStyle-ForeColor="Blue" ButtonType="Image"
       ImageUrl="~/images/Style/bntCopyTask.png">
       <ControlStyle Width="28px" />
       <ItemStyle ForeColor="Blue"></ItemStyle>
      </asp:ButtonField>
      <asp:ButtonField CommandName="Render" ItemStyle-ForeColor="Blue" Text="Render" ButtonType="Image"
       ImageUrl="~/images/Style/bntRender.gif">
       <ControlStyle Width="28px" />
       <ItemStyle ForeColor="Blue"></ItemStyle>
      </asp:ButtonField>
      <asp:ButtonField CommandName="AddNotes" Text="AddNotes" ItemStyle-ForeColor="Blue"
       ButtonType="Image" ImageUrl="~/images/Style/icon_new_child_note.gif">
       <ItemStyle ForeColor="Blue"></ItemStyle>
      </asp:ButtonField>
     </Columns>
     <RowStyle ForeColor="#000066" HorizontalAlign="Left" />
     <FooterStyle BackColor="White" ForeColor="#000066" Wrap="false" />
     <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
     <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
     <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
     <AlternatingRowStyle BackColor="#DCDCDC" />
    </asp:GridView>
    
     </ContentTemplate>
    </asp:UpdatePanel>
 
  <cc1:UpdatePanelAnimationExtender ID="upae" BehaviorID="animation" runat="server" TargetControlID="pnlNewMission">
                <Animations>
                    <OnUpdating>
                        
                        <Parallel duration="0">
                        
                           <ScriptAction Script="onUpdatingGrid();" />  
                           <EnableAction AnimationTarget="Button1" Enabled="false" />
                           <EnableAction AnimationTarget="Button2" Enabled="false" />
                           <FadeOut minimumOpacity=".5" />
                          </Parallel>
                    </OnUpdating>
                    <OnUpdated>
                        <Parallel duration="0">
                            <FadeIn minimumOpacity=".5" />
                            <EnableAction AnimationTarget="Button1" Enabled="true" />
                           <EnableAction AnimationTarget="Button2" Enabled="true" />
                            <ScriptAction Script="onUpdated(updateProgressDiv);" /> 
                        </Parallel> 
                    </OnUpdated>
                </Animations>
            </cc1:UpdatePanelAnimationExtender>
 <div id="updateProgressDiv" style="display: none; height: 40px; width: 40px;">
  <img src="/MissionManagementSystem/images/Rotator.gif" alt="" />
 </div>
 
 
 
Code Behind:
public void grdTaskList_RowCommand(Object sender, GridViewCommandEventArgs e)
 {
  
  
 
  if (string.Compare(e.CommandName, ActionModes.Render,true) == 0)
  {
   
   string errorMeesage = string.Empty;
   Byte[] data = DocumentPackaginUtility.Render(task, packId, out errorMeesage);
 
   if (data != null)
   {
 
 
    String fileName = task.xId + "_" + task.MissionTaskStatus + ".docx";
 
    Response.Clear();
    Response.Buffer = true;
    Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
    Response.AddHeader("Content-Length", data.Length.ToString());
    Response.ContentType = "application/vnd.msword.document.12";
    Response.OutputStream.Write(data, 0, data.Length);
    Response.ContentType = "application/x-zip-compressed";
    Response.End();
 
 
   }
 
 
 
  }
 
  if (string.Compare(e.CommandName, ActionModes.Copy, true) == 0)
  {
   string selectedTaskId = grdTaskList.DataKeys[Convert.ToInt32(e.CommandArgument)].Values["xId"].ToString();
   sessionDataObj.TaskId = new Guid(selectedTaskId);
   Session["SessionData"] = sessionDataObj;
   Response.Redirect(string.Format("{0}?Mode={1}", WebPagesNames.TaskDetails, ActionModes.Copy));
  }
 
 
 }