protected void GridView1_ExcelButtonClick(object sender, SearchGridEventArgs e)
        {
/*
 *          string filename = "Export.xlsx";
 *          System.IO.StringWriter tw = new System.IO.StringWriter();
 *          System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
 *          Quality data = new Quality();
 *
 *
 *          DataTable dt = new DataTable();
 *          dt = data.Sql_Datatable(consulta_sql());
 *
 *          System.IO.MemoryStream ms = DataTableToExcelXlsx(dt, "Sheet1");
 *          ms.WriteTo(HttpContext.Current.Response.OutputStream);
 *          HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
 *          HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
 *          HttpContext.Current.Response.StatusCode = 200;
 *          HttpContext.Current.Response.End();
 *          HttpContext.Current.Response.Write(tw.ToString());
 *          HttpContext.Current.Response.End();*/
        }
Beispiel #2
0
        protected void GridView1_ExcelButtonClick(object sender, SearchGridEventArgs e)
        {
            string filename = "Export.xlsx";

            System.IO.StringWriter       tw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
            Quality data = new Quality();


            DataTable dt = new DataTable();

            dt = data.Sql_Datatable(Fabricacion_stock(DropDownDesde.SelectedValue, DropDownHasta.SelectedValue));

            System.IO.MemoryStream ms = DataTableToExcelXlsx(dt, "Sheet1");
            ms.WriteTo(HttpContext.Current.Response.OutputStream);
            HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
            HttpContext.Current.Response.StatusCode = 200;
            HttpContext.Current.Response.End();
            HttpContext.Current.Response.Write(tw.ToString());
            HttpContext.Current.Response.End();
        }
        protected void GridView1_ExcelButtonClick(object sender, SearchGridEventArgs e)
        {
            string filename = "Export.xlsx";

            System.IO.StringWriter       tw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
            Quality data = new Quality();
            // string Con_Q = @"Data Source=192.168.1.195\sqlserver2008;Initial Catalog=QC600;Persist Security Info=True;User ID=dso;Password=dsodsodso";
            string Con_Q = @"Data Source=172.16.0.12;Initial Catalog=QC_PRUEBAS;Persist Security Info=True;User ID=dso;Password=dsodsodso";

            DataTable dt = new DataTable();

            dt = data.Sql_Datatable(consulta_sql(DropDownDesde.SelectedValue), Con_Q);

            System.IO.MemoryStream ms = DataTableToExcelXlsx(dt, "Sheet1");
            ms.WriteTo(HttpContext.Current.Response.OutputStream);
            HttpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
            HttpContext.Current.Response.StatusCode = 200;
            HttpContext.Current.Response.End();
            HttpContext.Current.Response.Write(tw.ToString());
            HttpContext.Current.Response.End();
        }
Beispiel #4
0
 protected void GridView1_CancelFilterButtonClick(object sender, SearchGridEventArgs e)
 {
     FilterToNthPage(e.SearchFilterValues, GridView1.CurrentSortExpression, GridView1.CurrentSortDirection, 1);
 }