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();
}
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();
}