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


C# Page.DesignerInitialize方法代码示例

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


在下文中一共展示了Page.DesignerInitialize方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:baotiit,项目名称:savvyplatform,代码行数:26,代码来源:PrintHelper.cs

示例2: Button3_Click

    protected void Button3_Click(object sender, EventArgs e)
    {
        string fileName = "export.xls";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
        HtmlTextWriter htw = new HtmlTextWriter(sw);

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

        // 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=" + fileName);
        Response.Charset = "UTF-8";
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.Write(sb.ToString());
        Response.End();
    }
开发者ID:zhouxin262,项目名称:SyxkWebSource,代码行数:32,代码来源:eadm_syrj_bj2.aspx.cs

示例3: btnExport_Click

    protected void btnExport_Click(object sender, EventArgs e)
    {
        Security s=  Session["sec"] as Security;
        if (s==null)
        {
            Response.Redirect("error.aspx");
        }
        string jsid = s.getUserCode();
        dbModule dm = new dbModule();
        string kcbh = KCDDL.SelectedValue;
        int syid= Convert.ToInt32(SYDDL.SelectedValue);
        DataTable dt = dm.getSyqdqk( kcbh ,syid,jsid );
        GridView1.DataSource = dt;
        GridView1.DataBind();
        GridView1.Caption = KCDDL.SelectedItem.Text + "---" + SYDDL.SelectedItem.Text + "签到情况";
        string fileName = "export.xls";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
        HtmlTextWriter htw = new HtmlTextWriter(sw);

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

        // 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=" + fileName);
        Response.Charset = "UTF-8";
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.Write(sb.ToString());
        Response.End();
    }
开发者ID:zhouxin262,项目名称:SyxkWebSource,代码行数:45,代码来源:eadm_syqdqk.aspx.cs

示例4: 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);

                    Page page = new 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();
                  }
             else
             {
                 //lblMsj.Text = "la tabla no contiene datos para exportar...";
             }
                //}
                //catch (Exception ex)
                //{
                //    EventLogger ev = new EventLogger();
                //    ev.Save("Seguimiento, export excel ", ex);
                //}
        }
    }
开发者ID:mborja,项目名称:mkpy_bccar,代码行数:43,代码来源:ReporteSeguimientos.aspx.cs

示例5: Button3_Click

    protected void Button3_Click(object sender, EventArgs e)
    {
        string xn = xnDDL.SelectedValue;
        string xq = xqDDL.SelectedValue;
        string z = zDDL.SelectedValue;
        string sysid = sysDDL.SelectedValue;
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["syxkConn"].ConnectionString);
        string sql = "select symc,jsxm,syxingq,syks,id from v_ywcsyjhb where syxn='" + xn + "' and syxq=" + xq + " and syz=" + z + " and sysid= " + sysid + "order by syxn,syxq,syz,syxingq,syks";
        SqlDataAdapter ada = new SqlDataAdapter(sql, conn);
        DataTable dt = new DataTable();
        ada.Fill(dt);
        Table1.Caption = xn + "年——" + xqDDL.SelectedItem.Text + "——" + zDDL.SelectedItem.Text + "——" + sysDDL.SelectedItem.Text + "实验安排表";

        for (int i = 1; i <= 7; i++)
        {
            for (int j = 1; j <= 7; j++)
            {

                TableCell tc = Table1.FindControl("TableCell" + i.ToString() + j.ToString()) as TableCell;
                if (tc == null)
                {
                }
                else
                {

                    //tc.Text = @"<a href=eadm_syjh_bg.aspx?&ap=1&syxingq=" + j.ToString() + @"&syks=" + i.ToString() + @">安排实验</a>";
                    tc.Text = " ";
                }
            }
        }

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string symc = dt.Rows[i]["symc"].ToString();
            string jsxm = dt.Rows[i]["jsxm"].ToString();
            string syjhid = dt.Rows[i]["id"].ToString();
            int syxingq = Convert.ToInt32(dt.Rows[i]["syxingq"]);
            int syks = Convert.ToInt32(dt.Rows[i]["syks"]);
            TableCell tc = Table1.FindControl("TableCell" + syks.ToString() + syxingq.ToString()) as TableCell;
            if (tc == null)
            {
            }
            else
            {
                //tc.Text = symc + "(" + jsxm + @")<br><a href=eadm_syjh_bg.aspx?ap=2&syjhid=" + syjhid + @">取消实验</a>";
                tc.Text = symc + "(" + jsxm + ")";
            }

        }

        string fileName =  "export.xls";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
        HtmlTextWriter htw = new HtmlTextWriter(sw);

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

        // 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(Table1);

        page.RenderControl(htw);

        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/vnd.ms-excel";
        Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
        Response.Charset = "UTF-8";
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.Write(sb.ToString());
        Response.End();
    }
开发者ID:zhouxin262,项目名称:SyxkWebSource,代码行数:80,代码来源:eadm_syjh_bg.aspx.cs

示例6: ImprimirControle

    /// <summary>
    /// Imprime um controle de uma página, com script
    /// <summary>
    public static void ImprimirControle(Control ctl, string script)
    {
        try
        {
            if (ctl != null)
            {
                StringWriter stringWrite = new StringWriter();
                HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

                if (ctl is WebControl)
                {
                    Unit w = new Unit(100, UnitType.Percentage);
                    ((WebControl)ctl).Width = w;
                }

                Page pg = new Page();
                pg.EnableEventValidation = false;

                if (script != string.Empty)
                {
                    pg.ClientScript.RegisterStartupScript(pg.GetType(), string.Empty, script);
                }

                HtmlForm frm = new HtmlForm();
                pg.Controls.Add(frm);

                frm.Attributes.Add("runat", "server");
                frm.Controls.Add(ctl);

                pg.DesignerInitialize();
                pg.RenderControl(htmlWrite);

                string strHTML = stringWrite.ToString();
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;
                HttpContext.Current.Response.Write(strHTML);

                string print = "<script type=\"text/javascript\" language=\"javascript\">window.print();</script>";
                HttpContext.Current.Response.Write(print);
                HttpContext.Current.Response.End();
                HttpContext.Current.Response.Flush();
            }
        }
        catch { }
    }
开发者ID:println,项目名称:S2B_ProjetoFinal,代码行数:48,代码来源:BaseUtils.cs

示例7: exportarExcel

    protected void exportarExcel(GridView nomGV)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
        System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);

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

        nomGV.EnableViewState = false;
        page.EnableEventValidation = false;

        page.DesignerInitialize();

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

        page.RenderControl(htw);

        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/vnd.ms-excel";

        Response.AddHeader("Content-Disposition", "attachment;filename=RegistroWeb.xls");
        Response.Charset = "UTF-8";
        Response.Write(sb.ToString());
        Response.End();
    }
开发者ID:jcollins-cibnor,项目名称:rep_registroWeb,代码行数:28,代码来源:ConsultaGeneral.aspx.cs

示例8: ReporteHorizontal

    // MODO HORIZONTAL
    private void ReporteHorizontal()
    {
        rrhh_listaasistenciaBL BL = new rrhh_listaasistenciaBL();
        tb_rrhh_listadeasistencia BE = new tb_rrhh_listadeasistencia();

        BE.empresaid = Session["ssEmpresaID"].ToString();

        BE.filtro = "1";
        BE.FECH1 = Convert.ToDateTime(FECH1.Text);
        BE.FECH2 = Convert.ToDateTime(FECH2.Text);

        try
        {
            DataTable dt = new DataTable();

            dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

            page.EnableEventValidation = false;
            page.DesignerInitialize();

            htw.Write("<table>");
            htw.Write("<tr>");
            htw.Write("<td></td>");
            htw.Write("</tr>");
            htw.Write("</table>");

            htw.Write("<table border='1' style='font:Tahoma; font-size:12px;'>");
            htw.Write("<tr style='color: #FFFFFF; font-weight: bold; background-color:#006699;'>");
            htw.Write("<td colspan='2' rowspan='2' align='center'>&nbsp;</td>");
            htw.Write("<td colspan='5' rowspan='2' align='center' style='font-size:18px;'><strong>LISTADO DE ASISTENCIAS DIARIAS</strong></td>");
            htw.Write("<td colspan='3' rowspan='2' align='center'>&nbsp;</td>");
            htw.Write("</tr>");
            htw.Write("</table>");

            htw.Write("<table style='font:Tahoma; font-size:13px;'>");
            htw.Write("<tr>");
            htw.Write("<td></td>");
            htw.Write("</tr>");
            htw.Write("<tr>");
            htw.Write("<td colspan='10'><strong>&nbsp;&nbsp;&nbsp;DEL:</strong>&nbsp;&nbsp;&nbsp;[" + FECH1.Text.ToString() + "]&nbsp;&nbsp;&nbsp;&nbsp; <strong>AL:</strong>&nbsp;&nbsp;&nbsp;[" + FECH2.Text.ToString() + "]</td>");
            htw.Write("</tr>");
            htw.Write("<tr>");
            htw.Write("<td></td>");
            htw.Write("</tr>");

            htw.Write("</table>");

            foreach (DataRow dr in dt.Rows)
            {

                String t_id = Convert.ToString(dt.Rows[0]["IDCC2"].ToString());
                String t_nom = Convert.ToString(dt.Rows[0]["NBCC2"].ToString());

                if (Equivalencias.Left(IDCC1.Text, 2).Trim() == "**")
                {
                    BE.IDCC1 = "";
                }
                else
                {
                    BE.IDCC1 = Equivalencias.Left(IDCC1.Text, 2).Trim();
                }

                BE.IDCC2 = dr["IDCC2"].ToString();
                BE.filtro = "2";

                BE.FECH1 = Convert.ToDateTime(FECH1.Text);
                BE.FECH2 = Convert.ToDateTime(FECH2.Text);

                DataTable dt2 = new DataTable();
                dt2 = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];

                if (dt2.Rows.Count > 0)
                {

                    htw.Write("<table border='1'style='font:Tahoma; font-size:12px;'>");
                    htw.Write("<tr>");
                    htw.Write("<td colspan='10'><strong>&nbsp;&nbsp;&nbsp;AREA MATRIZ:</strong>&nbsp;&nbsp;&nbsp;[" + dr["NBCC2"].ToString() + "]</td>");
                    htw.Write("</tr>");

                    htw.Write("<tr style='color: #FFFFFF; font-weight: bold; background-color:#006699;'>");
                    htw.Write("<td width='200' align='center'>DNI</td>");
                    htw.Write("<td width='250'  align='center'>TRABAJADOR</td>");
                    htw.Write("<td width='150'  align='center'>DIA 01</td>");
                    htw.Write("<td width='150'  align='center'>DIA 02</td>");
                    htw.Write("<td width='150'  align='center'>DIA 03</td>");
                    htw.Write("<td width='150'  align='center'>DIA 04</td>");
                    htw.Write("<td width='150'  align='center'>DIA 05</td>");
                    htw.Write("<td width='150'  align='center'>DIA 06</td>");
                    htw.Write("<td width='150'  align='center'>DIA 07</td>");
                    htw.Write("<td width='150'  align='center'>DIA 08</td>");
                    htw.Write("<td width='150'  align='center'>DIA 09</td>");
                    htw.Write("<td width='150'  align='center'>DIA 10</td>");
                    htw.Write("<td width='150'  align='center'>DIA 11</td>");
//.........这里部分代码省略.........
开发者ID:njmube,项目名称:ErpBapSoftNet_Producion,代码行数:101,代码来源:wf_rrhh_listaasistencia_all.aspx.cs

示例9: btnExcel2_Click

    protected void btnExcel2_Click(object sender, EventArgs e)
    {
        rrhh_listaasistenciaBL BL = new rrhh_listaasistenciaBL();
        tb_rrhh_listadeasistencia BE = new tb_rrhh_listadeasistencia();

        try
        {
            BE.FECH1 = Convert.ToDateTime(FECH1.Text);
            BE.FECH2 = Convert.ToDateTime(FECH2.Text);
        }
        catch (Exception ex)
        {
            FECH1.Text = Equivalencias.Left(System.DateTime.Now.Date.ToString(), 10);
            BE.FECH1 = Convert.ToDateTime(FECH1.Text);
        }

        try
        {
            BE.FECH2 = Convert.ToDateTime(FECH2.Text);
        }
        catch (Exception ex)
        {
            FECH2.Text = Equivalencias.Left(System.DateTime.Now.Date.ToString(), 10);
            BE.FECH2 = Convert.ToDateTime(FECH2.Text);
        }

        try
        {
            if (Equivalencias.IsNumeric(Equivalencias.Left(NOMBS.Text, 8).Trim()))
            {
                BE.DDNNI = Equivalencias.Left(NOMBS.Text, 8).Trim();
                BE.NOMBS = "";
            }
            else
            {
                BE.DDNNI = "";
                BE.NOMBS = NOMBS.Text.ToUpper().Trim();
            }

        }
        catch (Exception ex)
        {
            BE.DDNNI = "";
            BE.NOMBS = NOMBS.Text.ToUpper().Trim();
        }

        if (Equivalencias.Left(IDCC1.Text, 2).Trim() == "**")
        {
            BE.IDCC1 = "";
        }
        else
        {
            BE.IDCC1 = Equivalencias.Left(IDCC1.Text, 2).Trim();
        }

        if (Equivalencias.Left(IDCC2.Text, 3).Trim() == "***")
        {
            BE.IDCC2 = "";
        }
        else
        {
            BE.IDCC2 = Equivalencias.Left(IDCC2.Text, 3).Trim();
        }

        BE.flvis = false;

        //******** Exportando a Excel ***********

        try
        {

            DataTable dt = new DataTable();
            dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

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

            //Se Realiza las inicializaciones de la instancia de la clase Page
            page.DesignerInitialize();

            //*** GENERAR REPORTE
            htw.Write("<table width='10000' border='1' cellpadding='0' cellspacing='0' style='font:Tahoma; font-size:12px;'>");
            htw.Write("<tr>");
            htw.Write("<td width='79'>&nbsp;</td>");
            htw.Write("<td width='205'>&nbsp;</td>");
            htw.Write("<td colspan='6' rowspan='2' align='center' style='font-size:18px;'><strong>LISTADO DE ASISTENCIA</strong></td>");
            htw.Write("<td width='72'>&nbsp;</td>");
            htw.Write("<td width='76'>&nbsp;</td>");
            htw.Write("</tr>");
            htw.Write("<tr>");
            htw.Write("<td>&nbsp;</td>");
            htw.Write("<td>&nbsp;</td>");
            htw.Write("<td>&nbsp;</td>");
            htw.Write("<td>&nbsp;</td>");
//.........这里部分代码省略.........
开发者ID:njmube,项目名称:ErpBapSoftNet_Producion,代码行数:101,代码来源:wf_rrhh_listaasistencia_all.aspx.cs

示例10: Btn_Exportar_XLS_Click

    protected void Btn_Exportar_XLS_Click(object sender, EventArgs e)
    {
        // - Exporta Gridview a Excel, crea planilla completa aunque el Gridview tenga páginas
        if (GridView1.Rows.Count > 0 && GridView1.Visible == true)
        {
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter htw = new HtmlTextWriter(sw);
            Page page = new Page();
            HtmlForm form = new HtmlForm();

            string filename = "Listado.xls";

            GridView1.EnableViewState = false;
            GridView1.AllowPaging = false;
            GridView1.AllowSorting = false;
            GridView1.DataBind();
            GridView1.HeaderStyle.Reset();

            // Recorre todas las filas
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                GridViewRow row = GridView1.Rows[i];
                // Aplica estilo a cada celda, diferencia por el numero de columna si debe aplicar formato
                // texto o numero
                for (int j = 0; j < row.Cells.Count; j++)
                {
                    if (j == 3 || j == 6)
                    {
                        row.Cells[j].Attributes.Add("class", "num1");  // formato numero
                    }
                    else
                    {
                        row.Cells[j].Attributes.Add("class", "textmode");  // formato texto
                    }
                }
            }

            // Define estilo para formato texto y numérico

            string style = @"";
            page.EnableEventValidation = false;
            page.DesignerInitialize();
            page.Controls.Add(form);
            form.Controls.Add(GridView1);
            page.RenderControl(htw);
            Response.Clear();
            Response.Buffer = true;
            Response.ContentType = "text/plain";
            Response.AddHeader("Content-Disposition", "attachment;filename=" + filename);
            Response.Charset = "UTF-8";
            Response.ContentEncoding = Encoding.Default;
            // Escribe estilo
            Response.Write(style);
            // Agrega título en primera celda
            string Titulo = " LISTADO DE ASISTENCIA ";
            HttpContext.Current.Response.Write(Titulo);
            Response.Write(sb.ToString());
            Response.End();
        }
    }
开发者ID:njmube,项目名称:ErpBapSoftNet_Producion,代码行数:61,代码来源:wf_rrhh_listaasistencia_all.aspx.cs


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