Write this method in any pageload (or) in any button click event:
private void download(DataTable
dt)
{
Byte[] bytes = (Byte[])dt.Rows[0]["Document"];
Response.Buffer = true;
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = dt.Rows[0]["DocumentType"].ToString();
Response.AddHeader("content-disposition",
"attachment;filename="
+ dt.Rows[0]["NameOfDocument"].ToString());
Response.BinaryWrite(bytes);
Response.Flush();
Response.End();
}
0 comments:
Post a Comment