Hello Everybody I am using c#.net to make webapplication. I am making a webpage that export gridview data to excel. My code is as follow
protected void btnexport_Click(object sender, EventArgs e)
{
btnsubmit.Visible = false;
exporttoexcel();
expToExcel();
}
public override void VerifyRenderingInServerForm(Control control)
{
//base.VerifyRenderingInServerForm(control);
}
public void exporttoexcel()
{
Context.Response.Clear();
Context.Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Context.Response.Charset = "";
Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
Context.Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GridView1.RenderControl(htmlWrite);
Context.Response.Write(stringWrite.ToString());
Context.Response.End();
}
My gridview data is export to excel successfully but on EXPORTTOEXCEL button click event i am trying to false the visible property of another button submit, but i am successful to do it so please tell me how i set the visible property to false on EXPORTTOEXCEL button click event
Please give me reply soon my work is in midway
thank u to all in advance