public class Results { List<string>name{get;set;} List<string>phone{get;set;} public string id {get;set;} }
List<Results> lst = new List<Results>();
[HttpPost] public ActionResult ShowResult() { GridView gv = new GridView(); List<SearchResults> lst = (List<SearchResults>)TempData["lst"]; gv.DataSource = lst; 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 View(model); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)