Hallo Guys
-
I have an GridView inside Web User Control (.ascx), and i want to export that Gridview to Excel file. anybody have idea ? Thx :)
-
I have an GridView inside Web User Control (.ascx), and i want to export that Gridview to Excel file. anybody have idea ? Thx :)
try this code protected void Button1_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=FileName.xls"); Response.Charset = ""; // If you want the option to open the Excel file without saving than // comment out the line below // Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); GridView1.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); }
-
I have an GridView inside Web User Control (.ascx), and i want to export that Gridview to Excel file. anybody have idea ? Thx :)
Hi Dude Go to google and try it. if u didn;t get code post msg i will send u the code