Hello everyone. I am using C # .net to create a web application. I am making a webpage that exports gridview data to excel. My code is as follows
protected void btnexport_Click(object sender, EventArgs e)
{
btnsubmit.Visible = false;
exporttoexcel();
expToExcel();
}
public override void VerifyRenderingInServerForm(Control 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 an export to excel, but on the EXPORTTOEXCEL click the click button. I'm trying to enter the false visibility property of another submit button, but I can do it like that, please tell me how I set the visible property to false EXPORTTOEXCEL button click event
Please give me an answer, soon my work is in the middle of the way
thank everyone in advance
source
share