Team,
I've Radgrid in my webpage bounded to Datasource. I want to export that Radgrid datas to MSWord.
For that, I wrote the following code in the Button Click event:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Clear();
Response.Buffer =
true;
Response.AddHeader(
"content-disposition", "attachment;filename=FileName.doc");
Response.ContentEncoding = System.Text.
Encoding.UTF7;
Response.ContentType =
"application/vnd.word";
System.IO.
StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.
HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
//this.GridView1.RenderControl(oHtmlTextWriter);
this.RadGrid1.RenderControl(oHtmlTextWriter);
Response.Output.Write(oStringWriter.ToString());
Response.Flush();
Response.End();
}
but its throwing error as shown in the screen shot.
The same code works fine for GridView. Is it not possible for RadGrid? Pls. provide me a solution.
Thanks,
Rajesh N.