This is a migrated thread and some comments may be shown as answers.

How to use Response.Write avoiding ParserErrorException?

1 Answer 236 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Vijaya Sankar
Top achievements
Rank 1
Vijaya Sankar asked on 31 Jul 2012, 01:34 PM

Hi,

I am having a user control in RadAjaxPanel of a content page. Now i want to include an image button in the usercontrol which on clicking should export the page content  to a .doc file. i tried this code :
protected void Export(object sender, EventArgs e)
    {
        HttpContext.Current.Response.Clear();
        Response.ContentType = "application/msword";
        Response.AddHeader("Content-Disposition", "attachment;filename=Export.doc");
        StringBuilder strHTMLContent = new StringBuilder();
        strHTMLContent.Append("<html>");
        strHTMLContent.Append(lbExp.Text);
        strHTMLContent.Append("</html>");
        Response.Write(strHTMLContent);
        Response.End();
    }

This is working fine in a demo application with a single button,shows the download window and exports the content but in my application, it is showing the Sys.WebForms.PageRequestmanager.ParserErrorException owing to the RadAjaxPanel used.
I went through several methods of excluding the controls, etc but none works..

Please help me regarding this..
  

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 03 Aug 2012, 07:29 AM
Hi Vijaya,

You should disable Ajax for the control that triggers the export.
Exclude Controls from Ajaxifying

Regards,
Daniel
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Editor
Asked by
Vijaya Sankar
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or