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


C# WebControl.RenderControl方法代码示例

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


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

示例1: RenderVerbControl

 protected virtual void RenderVerbControl(HtmlTextWriter writer, WebControl control)
 {
     control.ApplyStyle(base.Zone.TitleBarVerbStyle);
     control.Page = base.WebPartManager.Page;
     control.RenderControl(writer);
 }
开发者ID:t1b1c,项目名称:lwas,代码行数:6,代码来源:BaseChrome.cs

示例2: RenderButton

 void RenderButton(HtmlTextWriter writer)
 {
     IList<AttributeInfo> attributeInfoByCategoryId = new List<AttributeInfo>();
     attributeInfoByCategoryId = ProductBrowser.GetAttributeInfoByCategoryId(this.CategoryId);
     if (attributeInfoByCategoryId.Count > 0)
     {
         for (int i = 0; (i < this.MaxNum) && (i < attributeInfoByCategoryId.Count); i++)
         {
             WebControl control = new WebControl(HtmlTextWriterTag.Label);
             control.Controls.Add(new LiteralControl("<li>"));
             control.RenderControl(writer);
             WebControl control2 = new WebControl(HtmlTextWriterTag.Label);
             control2.Controls.Add(new LiteralControl("<span>" + attributeInfoByCategoryId[i].AttributeName + ":</span>"));
             control2.Attributes.Add("class", this.NameCss);
             control2.RenderControl(writer);
             WebControl control3 = new WebControl(HtmlTextWriterTag.A);
             control3.Controls.Add(new LiteralControl("全部"));
             if (!this.LinkSelf)
             {
                 control3.Attributes.Add("target", "_blank");
             }
             string str = "";
             if (!string.IsNullOrEmpty(this.ValueStr))
             {
                 string[] strArray = this.ValueStr.Split(new char[] { '-' });
                 if (strArray.Length >= 1)
                 {
                     for (int j = 0; j < strArray.Length; j++)
                     {
                         string[] strArray2 = strArray[j].Split(new char[] { '_' });
                         if ((strArray2.Length > 0) && (strArray2[0].IndexOf(attributeInfoByCategoryId[i].AttributeId.ToString()) != -1))
                         {
                             strArray2[1] = "0";
                             strArray[j] = strArray2[0] + "_" + strArray2[1];
                         }
                         if (string.IsNullOrEmpty(str))
                         {
                             str = str + strArray[j];
                         }
                         else
                         {
                             str = str + "-" + strArray[j];
                         }
                     }
                     if (str.IndexOf(attributeInfoByCategoryId[i].AttributeId.ToString()) == -1)
                     {
                         object obj2 = str;
                         str = string.Concat(new object[] { obj2, "-", attributeInfoByCategoryId[i].AttributeId, "_0" });
                     }
                 }
             }
             else
             {
                 str = attributeInfoByCategoryId[i].AttributeId + "_0";
             }
             if (string.IsNullOrEmpty(this.Page.Request.QueryString["valueStr"]))
             {
                 control3.Attributes.Add("class", this.AllCss);
             }
             else
             {
                 string str2 = this.Page.Request.QueryString["valueStr"];
                 if (str2 == str)
                 {
                     control3.Attributes.Add("class", this.AllCss);
                 }
             }
             control3.Attributes.Add("href", this.CreateUrl(str));
             control3.RenderControl(writer);
             foreach (AttributeValueInfo info in attributeInfoByCategoryId[i].AttributeValues)
             {
                 WebControl control4 = new WebControl(HtmlTextWriterTag.A);
                 control4.Controls.Add(new LiteralControl(info.ValueStr));
                 string str3 = "";
                 if (!string.IsNullOrEmpty(this.ValueStr))
                 {
                     string[] strArray3 = this.ValueStr.Split(new char[] { '-' });
                     if (strArray3.Length >= 1)
                     {
                         for (int k = 0; k < strArray3.Length; k++)
                         {
                             string[] strArray4 = strArray3[k].Split(new char[] { '_' });
                             if ((strArray4.Length > 0) && (strArray4[0].IndexOf(attributeInfoByCategoryId[i].AttributeId.ToString()) != -1))
                             {
                                 strArray4[1] = info.ValueId.ToString();
                                 strArray3[k] = strArray4[0] + "_" + strArray4[1];
                             }
                             if (string.IsNullOrEmpty(str3))
                             {
                                 str3 = str3 + strArray3[k];
                             }
                             else
                             {
                                 str3 = str3 + "-" + strArray3[k];
                             }
                         }
                         if (str3.IndexOf(attributeInfoByCategoryId[i].AttributeId.ToString()) == -1)
                         {
                             object obj3 = str3;
                             str3 = string.Concat(new object[] { obj3, "-", info.AttributeId, "_", info.ValueId });
//.........这里部分代码省略.........
开发者ID:davinx,项目名称:himedi,代码行数:101,代码来源:Common_CategoryAttributesValue.cs

示例3: RenderButton

 void RenderButton(HtmlTextWriter writer)
 {
     DataTable brandsByCategoryId = ProductBrowser.GetBrandsByCategoryId(this.CategoryId);
     if ((brandsByCategoryId != null) && (brandsByCategoryId.Rows.Count > 0))
     {
         WebControl control = new WebControl(HtmlTextWriterTag.Label);
         control.Controls.Add(new LiteralControl("<span>品牌:</span>"));
         control.RenderControl(writer);
         WebControl control2 = new WebControl(HtmlTextWriterTag.A);
         control2.Controls.Add(new LiteralControl("全部"));
         control2.Attributes.Add("href", this.urlFormatForALL);
         if (this.Context.Request.RawUrl.IndexOf("brand") < 0)
         {
             control2.Attributes.Add("class", this.AllCss);
         }
         control2.RenderControl(writer);
         foreach (DataRow row in brandsByCategoryId.Rows)
         {
             WebControl control3 = new WebControl(HtmlTextWriterTag.A);
             control3.Controls.Add(new LiteralControl(row["BrandName"].ToString()));
             if (this.SelectedBrand == int.Parse(row["BrandId"].ToString()))
             {
                 control3.Attributes.Add("class", this.SelectCss);
             }
             else
             {
                 control3.Attributes.Add("href", this.urlFormat + row["BrandId"].ToString());
             }
             control3.RenderControl(writer);
         }
     }
 }
开发者ID:davinx,项目名称:himedi,代码行数:32,代码来源:Common_BrandsSearchList.cs

示例4: RenderControl

 public static string RenderControl(WebControl control)
 {
     StringBuilder builder = new StringBuilder();
     StringWriter strWriter = new StringWriter(builder);
     HtmlTextWriter writer = new HtmlTextWriter(strWriter);
     control.RenderControl(writer);
     return builder.ToString();
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:8,代码来源:PdfFunctions.cs

示例5: ExportToExcel

        ///<summary>
        ///导出到Excel
        ///</summary>
        ///<param name="ctrl">包含数据的控件</param>
        ///<param name="fileName">文件名</param>
        public static void ExportToExcel(WebControl ctrl, string fileName)
        {
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "application/ms-excel";
            HttpContext.Current.Response.Charset = "UTF-8";
            HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;
            //HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + "" + fileName + ".xls");
            HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8) + ".xls");//这样的话,可以设置文件名为中文,且文件名不会乱码。其实就是将汉字转换成UTF8
            HttpContext.Current.Response.BinaryWrite(System.Text.Encoding.UTF8.GetPreamble());

            StringWriter sw = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
            ctrl.RenderControl(htw);
            HttpContext.Current.Response.Write(sw.ToString());
            HttpContext.Current.Response.End();
        }
开发者ID:huaminglee,项目名称:cost3,代码行数:21,代码来源:ImportExportData.cs

示例6: getHTML

 public static String getHTML(WebControl aControl)
 {
     StringWriter sr = new StringWriter();
       HtmlTextWriter writer = new HtmlTextWriter(sr);
       aControl.RenderControl(writer);
       writer.Dispose();
       return sr.ToString();
 }
开发者ID:royriojas,项目名称:Clave-Projects,代码行数:8,代码来源:Utilidades.cs

示例7: GetControl

 /// <summary>
 /// Renders The Given Control Into The String Output
 /// </summary>
 /// <param name="control">The WebControl To Be Converted</param>
 /// <returns>The Rendered Result Of The Given Control</returns>
 /// 
 private static string GetControl(WebControl control)
 {
     StringWriter stringWriter = new StringWriter();
     HtmlTextWriter textWriter = new HtmlTextWriter(stringWriter);
     control.RenderControl(textWriter);
     textWriter.Flush();
     return textWriter.ToString();
 }
开发者ID:asr340,项目名称:owasp-code-central,代码行数:14,代码来源:Convertors.cs


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