Failed to parse the message received from the server, the. cs file with Response.Write output JS Bullet box error, with a local with the new

Source: Internet
Author: User

Reprint: https://www.cnblogs.com/shenyixin/archive/2012/03/08/2385376.html

Chinese:

Sys.WebForms.PageRequestManagerParserErrorException:

The message received from the server cannot be parsed, and the common reason for this error is that the response filter, httpmodules, or server trace is enabled when the corresponding modification is made by calling Response.Write ().

More information: An error occurred while parsing the nearby "output content".


Here's how to fix it:

1. If the server control that calls the Response.Write () method is using a UpdatePanel page, you only need to add a <Triggers> node under UpdatePanel. Register with Postbacktrigger to change the control. The code is as follows:

1. <asp:scriptmanager id= "ScriptManager1" runat= "Server" >
2. </asp:ScriptManager>
3. <asp:updatepanel id= "UpdatePanel1" runat= "Server" >
4. <Triggers>
5. <asp:postbacktrigger controlid= "Button2"/> <!--Button2 is the one that needs to be used in button2_click Events Response.Write () The button id-->
6. </Triggers>
7. <ContentTemplate>
8. <asp:button id= "Button2" runat= "Server" onclick= "button2_click" text= "button"/>
9. <asp:updateprogress id= "UpdateProgress1" runat= "Server" >
Ten. <ProgressTemplate></ProgressTemplate>
One. </asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>

2. However, if you are using UpdatePanel in a master page, you cannot resolve the above method, or you may experience an error similar to the following:

A control with ID ' Btnexport ' could isn't being found for the trigger in UpdatePanel ' UpdatePanel1 '.

This is mainly because UpdatePanel1 cannot find the controls registered in <asp:postbacktrigger controlid= "Btnexport"/>, because we generally do not add this control (Btnexport) to the master page. (Of course, if a control with ID Btnexport is added under the UpdatePanel <ContentTemplate> node, there is no error.) )

If such an error occurs, my workaround is to add the following code to the Page_Load event where the page number of the control where the Response.Write () method is needed is used:
((ScriptManager) Master.findcontrol ("ScriptManager1")). RegisterPostBackControl (Btnexport);
ScriptManager1 is <asp:scriptmanager id= "ScriptManager1" runat= "Server" > </asp:ScriptManager> ID

Failed to parse the message received from the server, the. cs file with Response.Write output JS Bullet box error, with a local with the new

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.