当前位置: 首页>>代码示例>>C#>>正文


C# Page.DesignerInitialize方法代码示例

本文整理汇总了C#中System.Web.UI.Page.DesignerInitialize方法的典型用法代码示例。如果您正苦于以下问题:C# Page.DesignerInitialize方法的具体用法?C# Page.DesignerInitialize怎么用?C# Page.DesignerInitialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.Page的用法示例。


在下文中一共展示了Page.DesignerInitialize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrintWebControl

 public static void PrintWebControl(Control ctrl, string Script)
 {
     StringWriter stringWrite = new StringWriter();
     System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
     if (ctrl is WebControl)
     {
         Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w;
     }
     Page pg = new Page();
     pg.EnableEventValidation = false;
     if (Script != string.Empty)
     {
         pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script);
     }
     HtmlForm frm = new HtmlForm();
     pg.Controls.Add(frm);
     frm.Attributes.Add("runat", "server");
     frm.Controls.Add(ctrl);
     pg.DesignerInitialize();
     pg.RenderControl(htmlWrite);
     string strHTML = stringWrite.ToString();
     HttpContext.Current.Response.Clear();
     HttpContext.Current.Response.Write(strHTML);
     HttpContext.Current.Response.Write("<script>window.print();</script>");
     HttpContext.Current.Response.End();
 }
开发者ID:manivts,项目名称:impexcubeapp,代码行数:26,代码来源:PrintHelper.cs

示例2: PrintWebControl

        public static void PrintWebControl(Control ControlToPrint, Control MyStyle)
        {
            StringWriter stringWrite = new StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            if (ControlToPrint is WebControl)
            {
                Unit w = new Unit(100, UnitType.Percentage);
                ((WebControl)ControlToPrint).Width = w;
            }
            System.Web.UI.Page pg = new System.Web.UI.Page();
            pg.EnableEventValidation = false;
            HtmlForm frm = new HtmlForm();

            frm.Controls.Add(MyStyle);

            pg.Controls.Add(frm);
            frm.Attributes.Add("runat", "server");
            frm.Controls.Add(ControlToPrint);
            pg.DesignerInitialize();
            pg.RenderControl(htmlWrite);
            string strHTML = stringWrite.ToString();
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write(strHTML);
            HttpContext.Current.Response.Write("<script>window.print();</script>");
            HttpContext.Current.Response.End();
        }
开发者ID:tsandtm,项目名称:BOEdu,代码行数:26,代码来源:Prints.cs

示例3: imgBtnExportarExcelArchivos_Click

        protected void imgBtnExportarExcelArchivos_Click(object sender, ImageClickEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

            gvJobCancelacioneXTicket.AllowPaging = false;
            gvJobCancelacioneXTicket.DataBind();
            gvJobCancelacioneXTicket.EnableViewState = false;

            page.EnableEventValidation = false;

            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(gvJobCancelacioneXTicket);

            page.RenderControl(htw);

            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=ArchivosDeProcedimiento.xls");
            Response.Charset = "UTF-8";

            //Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentEncoding = System.Text.Encoding.Default;

            Response.Write(sb.ToString());
            Response.End();
        }
开发者ID:jlaua,项目名称:WebHomologacion,代码行数:32,代码来源:wfrmTicketsEnEjecucionHostCertificacion.aspx.cs

示例4: imgBtnExportarExcelEjecucion_Click

        protected void imgBtnExportarExcelEjecucion_Click(object sender, ImageClickEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

            gvIncidenciasBatch.AllowPaging = false;
            gvIncidenciasBatch.DataBind();
            gvIncidenciasBatch.EnableViewState = false;

            page.EnableEventValidation = false;

            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(gvIncidenciasBatch);

            page.RenderControl(htw);

            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=ReporteIncidenciasBatch" + DateTime.Now.ToShortDateString() + ".xls");
            Response.Charset = "UTF-8";

            Response.ContentEncoding = System.Text.Encoding.Default;

            Response.Write(sb.ToString());
            Response.End();
        }
开发者ID:jlaua,项目名称:WebHomologacion,代码行数:31,代码来源:wfrmDescargarIncidenciasBatch.aspx.cs

示例5: PrintWebControl

        public static void PrintWebControl(Control ctrl, string Script)
        {
            StringWriter stringWrite = new StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            if (ctrl is WebControl)
            {
                Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w;
            }
            Page pg = new Page();
            pg.EnableEventValidation = false;
            pg.StyleSheetTheme = "../CSS/order.css";
            if (Script != string.Empty)
            {
                pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script);
            }

            HtmlLink link = new HtmlLink();
            link.Href = "../CSS/order.css";
            HtmlForm frm = new HtmlForm();
            pg.Controls.Add(frm);
            frm.Attributes.Add("runat", "server");
            frm.Controls.Add(ctrl);
            pg.DesignerInitialize();
            pg.RenderControl(htmlWrite);
            string strHTML = stringWrite.ToString();
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write("<head runat='server'> <title>Printer - Bản in tại Support.evnit.evn.com.vn</title> <link type='text/css' rel='stylesheet' href='../CSS/order.css'><link type='text/css' rel='stylesheet' href='../CSS/style.css'></head>");
            HttpContext.Current.Response.Write(strHTML);
            HttpContext.Current.Response.Write("<script>window.print();</script>");
            HttpContext.Current.Response.End();
        }
开发者ID:trungjc,项目名称:quanlyhocsinh,代码行数:31,代码来源:PrintHelper.cs

示例6: Boton_Excel_Dios_Click

 protected void Boton_Excel_Dios_Click(object sender, EventArgs e)
 {
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter htw = new HtmlTextWriter(sw);
     Page page = new Page();
     HtmlForm form = new HtmlForm();
     GridView_Dios.DataSourceID = string.Empty;
     GridView_Dios.EnableViewState = false;
     GridView_Dios.AllowPaging = false;
     GridView_Dios.DataSource = p2P.mostrarPrecios(0);
     GridView_Dios.DataBind();
     page.EnableEventValidation = false;
     page.DesignerInitialize();
     page.Controls.Add(form);
     form.Controls.Add(GridView_Dios);
     page.RenderControl(htw);
     Response.Clear();
     Response.Buffer = true;
     Response.ContentType = "applicattion/vnd.ms-excel";
     Response.AddHeader("Content-Disposition", "attachment;filename=Panel_Precios.xls");
     Response.Charset = "UTF-8";
     Response.ContentEncoding = Encoding.Default;
     Response.Write(sb.ToString());
     Response.End();
 }
开发者ID:Gutylic,项目名称:websupervisor,代码行数:26,代码来源:2-precios.aspx.cs

示例7: PrintWebControl

        public void PrintWebControl(Control ControlToPrint)
        {
            StringWriter stringWrite = new StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            if (ControlToPrint is WebControl)
            {
                Unit w = new Unit(100, UnitType.Percentage);
                ((WebControl)ControlToPrint).Width = w;

            }

            Page pg = new Page();

            pg.EnableEventValidation = false;
            HtmlForm frm = new HtmlForm();
            pg.Controls.Add(frm);
            frm.Attributes.Add("runat", "server");
            frm.Controls.Add(ControlToPrint);
            pg.DesignerInitialize();
            pg.RenderControl(htmlWrite);

            string strHTML = stringWrite.ToString();
            string wstawka = Server.MapPath("~").ToString();

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write(htmlToImage(strHTML, zmianaAdresu(wstawka)));

            HttpContext.Current.Response.Write("<script>window.print();</script>");
            HttpContext.Current.Response.End();

            Response.Redirect("~/ListaImprez.aspx");
        }
开发者ID:donor,项目名称:Projects,代码行数:32,代码来源:Wplaty.aspx.cs

示例8: Export

        protected bool Export()
        {
            try
            {
                //Descargo el objeto tabla de la sesion con nombre "p_c" ó (Plan Operativo)
                HtmlTable objTable = (HtmlTable)Session["p_c"];

                //Instancio un objeto del tipo StringBuilder objsb
                StringBuilder objsb = new StringBuilder();

                //Instancio un objeto del tipo System.IO.StringWriter sw
                System.IO.StringWriter sw = new System.IO.StringWriter(objsb);

                //Instancio un objeto del tipo HtmlTextWriter htw
                HtmlTextWriter htw = new HtmlTextWriter(sw);

                //Instancio un objeto del tipo System.Web.UI.Page
                System.Web.UI.Page pagina = new System.Web.UI.Page();

                //Instancio un objeto del tipo HtmlForm
                var form = new HtmlForm();

                //Asigno valores a propiedades del objeto page instanciado
                pagina.EnableEventValidation = false;
                pagina.DesignerInitialize();

                //Agrego el formulario instaciado a la coleccionde paginas
                pagina.Controls.Add(form);

                //Agrego el objeto tabla a la coleccion de controles del formulario instanciado anteriormente
                form.Controls.Add(objTable);

                //Realizo el proceso de renderizacion para los elementos agregados a la pagina instanciada
                pagina.RenderControl(htw);

                //Limpio el canal de respuesta para esta peticion
                Response.Clear();

                //Habilito el buffer
                Response.Buffer = true;

                //Asigno el tipo de contenido
                Response.ContentType = "application/vnd.ms-excel";
                //Asigno el nombre del documento a exportar en el header del response
                Response.AddHeader("Content-Disposition", "attachment;filename=Plan_Operativo.xls");
                //Asigno el tipo de charset "UTF-8"
                Response.Charset = "UTF-8";
                //Establesco la configuracion por defecto para la codificacion
                Response.ContentEncoding = Encoding.Default;
                //Realizo el proceso de escritura para el objeto objsb
                Response.Write(objsb.ToString());
                //Finalizo la respuesta
                Response.End();
                return true;
            }
            catch (Exception) { return false; }
        }
开发者ID:MGGROUP,项目名称:BASICA,代码行数:57,代码来源:ReportMarcoLogico.aspx.cs

示例9: imgBtnExcel_Click

        protected void imgBtnExcel_Click(object sender, ImageClickEventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            Page page = new Page();
            HtmlForm form = new HtmlForm();

            gdUsuario.EnableViewState = false;

            // Deshabilitar la validación de eventos, sólo asp.net 2
            page.EnableEventValidation = false;

            // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
            page.DesignerInitialize();

            page.Controls.Add(form);
            form.Controls.Add(gdUsuario);

            page.RenderControl(htw);

            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("Content-Disposition", "attachment;filename=datosHotel.xls");
            Response.Charset = "UTF-8";
            Response.ContentEncoding = Encoding.Default;
            Response.Write(sb.ToString());
            Response.End();

            //Response.Clear();

            //Response.AddHeader("content-disposition", "attachment;filename=Catalogo_Productos.xls");

            //Response.Charset = "";

            //Response.ContentType = "application/vnd.xls";

            //StringWriter StringWriter = new System.IO.StringWriter();

            //HtmlTextWriter HtmlTextWriter = new HtmlTextWriter(StringWriter);

            //gvDatosAdmin.AllowPaging = false;

            //Response.Write(StringWriter.ToString());

            //Response.End();
        }
开发者ID:kEpEx,项目名称:CreaturHotelListo,代码行数:49,代码来源:MostrarUsuarios.aspx.cs

示例10: PrintWebControl

        public void PrintWebControl(Control ControlToPrint)
        {
            StringWriter stringWrite = new StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            if (ControlToPrint is WebControl)
            {
                Unit w = new Unit(100, UnitType.Percentage);
                ((WebControl)ControlToPrint).Width = w;

            }

            Page pg = new Page();

            pg.EnableEventValidation = false;
            HtmlForm frm = new HtmlForm();
            pg.Controls.Add(frm);
            frm.Attributes.Add("runat", "server");
            frm.Controls.Add(ControlToPrint);
            pg.DesignerInitialize();
            pg.RenderControl(htmlWrite);

            string strHTML = stringWrite.ToString();
            string wstawka = Server.MapPath("~").ToString();
            string path = String.Format("{0}\\Images\\Rezerwacje\\{1}.gif", Server.MapPath("~"), Session["ZamowienieId"]);

            //korzystanie z biblioteki websiteScreenshote

            WebsitesScreenshot.WebsitesScreenshot _Obj = new WebsitesScreenshot.WebsitesScreenshot();
            WebsitesScreenshot.WebsitesScreenshot.Result _Result = _Obj.CaptureHTML(htmlToImage(strHTML, zmianaAdresu(wstawka)));

            if (_Result == WebsitesScreenshot.WebsitesScreenshot.Result.Captured)
            {
                _Obj.ImageFormat = WebsitesScreenshot.WebsitesScreenshot.ImageFormats.GIF;
                _Obj.SaveImage(path);
            }
            _Obj.Dispose();

            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write(strHTML);
            Session[Cart.Ident] = null;
            HttpContext.Current.Response.Write("<script>window.print();</script>");
            HttpContext.Current.Response.End();

            Response.Redirect("~/ListaImprez.aspx");
        }
开发者ID:donor,项目名称:Projects,代码行数:45,代码来源:CheckOut.aspx.cs

示例11: btnExportar_Command

 protected void btnExportar_Command(object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Exportar")
     {
          if (GridView1.Rows.Count > 0 && GridView1.Visible == true )
         {
         //try
         //{
             lblMsj.Text = "";
             StringBuilder sb = new StringBuilder();
             StringWriter sw = new StringWriter(sb);
             HtmlTextWriter htw = new HtmlTextWriter(sw);
             System.Web.UI.Page page = new System.Web.UI.Page();
             HtmlForm form = new HtmlForm();
             GridView1.EnableViewState = false;
             // Deshabilitar la validación de eventos, sólo asp.net 2
             page.EnableEventValidation = false;
             // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
             page.DesignerInitialize();
             page.Controls.Add(form);
             form.Controls.Add(GridView1);
             page.RenderControl(htw);
             Response.Clear();
             Response.Buffer = true;
             Response.ContentType = "application/vnd.ms-excel";
             Response.AddHeader("Content-Disposition", "attachment;filename=Evaluaciones.xls");
             Response.Charset = "UTF-8";
             Response.ContentEncoding = Encoding.Default;
             Response.Write(sb.ToString());
             Response.End();
         //}
         //catch (Exception ex)
         //{
         //    EventLogger ev = new EventLogger();
         //    ev.Save("EvaluacionesDetalle, export excel ", ex);
         //}
         }
          else
          {
              lblMsj.Text = "la tabla no contiene datos para exportar...";
          }
     }
 }
开发者ID:mborja,项目名称:mkpy_bccar,代码行数:43,代码来源:EvaluacionesDetalle.aspx.cs

示例12: Export

        protected bool Export()
        {
            try
            {
                string html = txtgantt_html.Value;

                html = html.Replace("!1!", ">");
                html = html.Replace("!2!", "<");
                html = html.Replace("!3!", "=");
                html = html.Replace("!4!", "#");
                html = html.Replace("!5!", "&");

                HtmlGenericControl objTable = new HtmlGenericControl("table");

                objTable.InnerHtml = html;

                StringBuilder objsb = new StringBuilder();
                System.IO.StringWriter sw = new System.IO.StringWriter(objsb);
                HtmlTextWriter htw = new HtmlTextWriter(sw);
                System.Web.UI.Page pagina = new System.Web.UI.Page();
                var form = new HtmlForm();
                pagina.EnableEventValidation = false;
                pagina.DesignerInitialize();
                pagina.Controls.Add(form);
                form.Controls.Add(objTable);
                pagina.RenderControl(htw);
                Response.Clear();
                Response.Buffer = true;
                Response.ContentType = "application/vnd.ms-excel";

                Response.AddHeader("Content-Disposition", "attachment;filename=Cronograma.xls");

                Response.Charset = "UTF-8";
                Response.ContentEncoding = Encoding.Default;
                Response.Write(objsb.ToString());
                Response.End();
                return true;
            }
            catch (Exception) { return false; }
        }
开发者ID:kaganyuksel,项目名称:esm,代码行数:40,代码来源:DiagramaGant.aspx.cs

示例13: ExportToExcel

 private void ExportToExcel(string nameReport, GridView wControl)
 {
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter htw = new HtmlTextWriter(sw);
     Page page = new Page();
     ListarAsistencia form = new ListarAsistencia();
     wControl.EnableViewState = false;
     // Deshabilitar la validación de eventos, sólo asp.net 2
     page.EnableEventValidation = false;
     // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
     page.DesignerInitialize();
     page.Controls.Add(form);
     form.Controls.Add(wControl);
     page.RenderControl(htw);
     Response.Clear();
     Response.Buffer = true;
     Response.ContentType = "application/vnd.ms-excel";
     Response.AddHeader("Content-Disposition", "attachment;filename=data.xls");
     Response.Charset = "UTF-8";
     Response.ContentEncoding = Encoding.Default;
     Response.Write(sb.ToString());
     Response.End();
 }
开发者ID:pabloguevara144,项目名称:RegistroAsistencia,代码行数:24,代码来源:ListarAsistencia.aspx.cs

示例14: ExportGridView

 public void ExportGridView(GridView gridView, string nombreArchivo)
 {
     var control = ((Control)gridView);
     PrepareGridViewForExport(ref control);
     StringBuilder sb = new StringBuilder();
     StringWriter sw = new StringWriter(sb);
     HtmlTextWriter htw = new HtmlTextWriter(sw);
     Page pagina = new Page();
     dynamic form = new HtmlForm();
     gridView.EnableViewState = false;
     pagina.EnableEventValidation = false;
     pagina.DesignerInitialize();
     pagina.Controls.Add(form);
     form.Controls.Add(gridView);
     pagina.RenderControl(htw);
     Response.Clear();
     Response.Buffer = true;
     Response.ContentType = "application/vnd.ms-excel";
     Response.AddHeader("Content-Disposition", "attachment;filename=" + nombreArchivo);
     Response.Charset = "UTF-8";
     Response.ContentEncoding = Encoding.Default;
     Response.Write(sb.ToString());
     Response.End();
 }
开发者ID:EduardoGarcia360,项目名称:p1h,代码行数:24,代码来源:paginaBase.cs

示例15: Export

        protected bool Export(HtmlTable table)
        {
            try
            {

                StringBuilder objsb = new StringBuilder();
                System.IO.StringWriter sw = new System.IO.StringWriter(objsb);
                HtmlTextWriter htw = new HtmlTextWriter(sw);
                System.Web.UI.Page pagina = new System.Web.UI.Page();
                var form = new HtmlForm();
                pagina.EnableEventValidation = false;
                pagina.DesignerInitialize();
                pagina.Controls.Add(form);
                form.Controls.Add(table);
                pagina.RenderControl(htw);
                Response.Clear();
                Response.Buffer = true;
                Response.ContentType = "application/vnd.ms-excel";
                Response.AddHeader("Content-Disposition", "attachment;filename=MarcoLogico.xls");
                Response.Charset = "UTF-8";
                Response.ContentEncoding = Encoding.Default;
                Response.Write(objsb.ToString());
                Response.End();
                return true;
            }
            catch (Exception) { return false; }
        }
开发者ID:MGGROUP,项目名称:BASICA,代码行数:27,代码来源:ArbolProblemas.aspx.cs


注:本文中的System.Web.UI.Page.DesignerInitialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。