public ActionResult ExportData() { string[] abc = { "AAA", "BBB", "CCC" }; GridView gv = new GridView(); gv.DataSource = abc; gv.DataBind(); Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=Marklist.xls"); Response.ContentType = "application/ms-excel"; Response.Charset = ""; StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); gv.RenderControl(htw); Response.Output.Write(sw.ToString()); Response.Flush(); Response.End(); return RedirectToAction("_EligibilityCriteria"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)