i have done Export to Excel code from Gridview to Excel Sheet. i have got the download Dialog box. How to Get the Button Value whether the datas are saved/Downloaded or Dialog box is closed by hitting cancel button .....
i want to identify the button hitted is Save or Cancel in the Download dialog Box.
code :
public void Export(GridView GridView1, DataTable dtGuid) {
string attachment = "attachment; filename=ScratchcardDetails.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.AllowPaging = false;
GridView1.Visible = true;
GridView1.DataSource = dtGuid;
GridView1.DataBind();
// Create a form to contain the grid
HtmlForm frm = new HtmlForm();
this.GridView1.Parent.Controls.Add(frm);
frm.Attributes["runat"] = "server";
frm.Controls.Add(this.GridView1);
frm.RenderControl(htw);
//Response.Write(style);
Response.Write(sw.ToString());
Response.End();
}