本文整理汇总了C#中System.Web.UI.WebControls.Repeater.RenderControl方法的典型用法代码示例。如果您正苦于以下问题:C# Repeater.RenderControl方法的具体用法?C# Repeater.RenderControl怎么用?C# Repeater.RenderControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.WebControls.Repeater
的用法示例。
在下文中一共展示了Repeater.RenderControl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExportExcelReport
/// <summary>
/// ����Repeater��������reportname��excel����
/// </summary>
/// <param name="reportname">�������ִ�xls��</param>
/// <param name="rp">Repeater�ؼ�</param>
public static void ExportExcelReport(string reportname,Repeater rp)
{
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ContentEncoding=System.Text.Encoding.UTF8;
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode(reportname));
System.Web.HttpContext.Current.Response.ContentType = "application/ms-excel";
rp.RenderControl(new HtmlTextWriter(System.Web.HttpContext.Current.Response.Output));
System.Web.HttpContext.Current.Response.End();
}
示例2: DataTable1Excel
/// </summary>
/// 导出Excel文件,自动返回可下载的文件流
/// </summary>
public static void DataTable1Excel(Repeater repeater, System.Data.DataTable dtData)
{
HttpContext curContext = HttpContext.Current;
StringWriter strWriter = null;
HtmlTextWriter htmlWriter = null;
if (dtData != null)
{
curContext.Response.AddHeader("content-disposition", "attachment;filename=" + "用户统计表-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
curContext.Response.ContentType = "application/vnd.ms-excel";
curContext.Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
curContext.Response.Charset = "utf-8";
strWriter = new StringWriter();
htmlWriter = new HtmlTextWriter(strWriter);
repeater.DataSource = dtData;
repeater.DataBind();
repeater.RenderControl(htmlWriter);
curContext.Response.Write(strWriter.ToString());
curContext.Response.End();
}
}
示例3: getHTML
public static String getHTML(Repeater r)
{
StringWriter sr = new StringWriter();
HtmlTextWriter writer = new HtmlTextWriter(sr);
r.RenderControl(writer);
writer.Dispose();
return sr.ToString();
}