本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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");
}
示例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; }
}
示例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();
}
示例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");
}
示例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...";
}
}
}
示例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; }
}
示例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();
}
示例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();
}
示例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; }
}