Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello sir,

I am working with crystal reports. I created a button on crystal report toolbar using the following code:
C#
reportDocument = (ReportDocument)Session["reportDocument"];
       CrystalReportViewer1.ReportSource = reportDocument;
        System.Web.UI.Control oControl = CrystalReportViewer1.Controls[2];
        //Button oButton = new Button();
        //oButton.ID = "newButton";
        //oButton.Text = "My New Button";
        //oControl.Controls.Add(oButton);
        ImageButton BtnExport = new ImageButton();
        BtnExport.ID = "BtnExport";
        BtnExport.ImageUrl = "~/images/xls.png";
        // BtnExport.ToolTip = "Zoom";
        BtnExport.Click += ImgBtnXls_Click;
        BtnExport.EnableViewState = true;
        oControl.Controls.Add(BtnExport);
        UpdatePanel UpdatePanel1 = new UpdatePanel();

        System.Web.UI.PostBackTrigger trigger = new System.Web.UI.PostBackTrigger();

        trigger.ControlID = BtnExport.UniqueID.ToString();
        UpdatePanel1.Triggers.Add(trigger);

My problem is whenever I click the button to export the report, it shows an error like below:
Microsoft JScript runtime 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.
Details: Error parsing near '�ࡱ�'.

If anyone knows the reason, please help me.
Posted
Updated 22-Oct-10 23:56pm
v2

1 solution

Add a PostBackTrigger to your UpdatePanel for the button BtnExport. That's all.
XML
<Triggers>
<asp:PostBackTrigger ControlID="BtnExport" />
</Triggers>

For more details read this post. Sys.WebForms.PageRequestManagerParserErrorException - what it is and how to avoid it[^]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900