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

Can you help me export ".doc" in OnItemCommand GridView

2 Answers 29 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vo
Top achievements
Rank 1
Vo asked on 22 Feb 2013, 02:33 AM
I want export ".doc" in event OnItemCommand of GridView but when i debug then it do not export.
Can you help me.
Code bihe:
if (e.CommandName == "ExportWord")
{
           string attachment = "attachment; filename=abc";
           HttpContext.Current.Response.Clear();
           HttpContext.Current.Response.AddHeader("content-disposition", attachment);
          // HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"; //office 2003
           HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Unicode;
          HttpContext.Current.Response.ContentType = "application/ms-word";
         HttpContext.Current.Response.BinaryWrite(System.Text.Encoding.Unicode.GetPreamble());
           HttpContext.Current.Response.Write("abc");
            HttpContext.Current.Response.End();
}

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Feb 2013, 05:07 AM
Hello,

please check below link. (in this link there is also sample demo/code)
http://www.telerik.com/community/code-library/aspnet-ajax/general/export-radgrid-content-to-excel-word-csv-pdf-with-ajax-enabled.aspx

Thanks,
Jayesh Goyani
0
Vo
Top achievements
Rank 1
answered on 25 Feb 2013, 02:18 AM
Thanks, I had fix my error.
Tags
Grid
Asked by
Vo
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Vo
Top achievements
Rank 1
Share this question
or