Ejemplo n.º 1
0
        public ActionResult ExportToExcel(int id)
        {
            Ytbl_ProgCorteModels corteResult = new Ytbl_ProgCorteModels();

            var gv = new GridView();

            gv.DataSource = corteResult.getReport(id);
            gv.DataBind();
            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment; filename=DemoExcel.xls");
            Response.ContentType = "application/ms-excel";
            Response.Charset     = "";
            StringWriter   objStringWriter   = new StringWriter();
            HtmlTextWriter objHtmlTextWriter = new HtmlTextWriter(objStringWriter);

            gv.RenderControl(objHtmlTextWriter);
            Response.Output.Write(objStringWriter.ToString());
            Response.Flush();
            Response.End();
            return(View("Result"));
        }
Ejemplo n.º 2
0
        public ActionResult Result(int id)
        {
            Ytbl_ProgCorteModels corteResult = new Ytbl_ProgCorteModels();

            return(View(corteResult.getReport(id)));
        }