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


C# DropDownList.ApplyStyle方法代码示例

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


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

示例1: RenderFooter

        protected override void RenderFooter(HtmlTextWriter writer) {
            writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "4px");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            DropDownList zonesDropDownList = new DropDownList();
            zonesDropDownList.ClientIDMode = ClientIDMode.AutoID;
            zonesDropDownList.ID = ZonesID;

            // Populate the DropDownList
            if (DesignMode) {
                // Add sample zone to dropdown
                zonesDropDownList.Items.Add(SR.GetString(SR.Zone_SampleHeaderText));
            }
            else {
                if (WebPartManager != null && WebPartManager.Zones != null) {
                    foreach (WebPartZoneBase zone in WebPartManager.Zones) {
                        if (zone.AllowLayoutChange) {
                            Debug.Assert(!String.IsNullOrEmpty(zone.ID));
                            ListItem item = new ListItem(zone.DisplayTitle, zone.ID);
                            if (String.Equals(zone.ID, _selectedZoneID, StringComparison.OrdinalIgnoreCase)) {
                                item.Selected = true;
                            }
                            zonesDropDownList.Items.Add(item);
                        }
                    }
                }
            }

            LabelStyle.AddAttributesToRender(writer, this);
            // Only render the "for" attribute if we are going to render the associated DropDownList (VSWhidbey 541458)
            if (zonesDropDownList.Items.Count > 0) {
                writer.AddAttribute(HtmlTextWriterAttribute.For, zonesDropDownList.ClientID);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Label);
            writer.Write(SelectTargetZoneText);
            writer.RenderEndTag();

            // Render   before the DropDownList (VSWhidbey 77709)
            writer.Write(" ");

            zonesDropDownList.ApplyStyle(EditUIStyle);
            // Do not render empty DropDownList (VSWhidbey 534498)
            if (zonesDropDownList.Items.Count > 0) {
                zonesDropDownList.RenderControl(writer);
            }

            writer.Write(" ");

            RenderVerbs(writer);

            writer.RenderEndTag();  // Div
        }
开发者ID:uQr,项目名称:referencesource,代码行数:52,代码来源:CatalogZoneBase.cs

示例2: RenderFooter

 protected override void RenderFooter(HtmlTextWriter writer)
 {
     writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "4px");
     writer.RenderBeginTag(HtmlTextWriterTag.Div);
     DropDownList list = new DropDownList {
         ClientIDMode = ClientIDMode.AutoID,
         ID = this.ZonesID
     };
     if (base.DesignMode)
     {
         list.Items.Add(System.Web.SR.GetString("Zone_SampleHeaderText"));
     }
     else if ((base.WebPartManager != null) && (base.WebPartManager.Zones != null))
     {
         foreach (WebPartZoneBase base2 in base.WebPartManager.Zones)
         {
             if (base2.AllowLayoutChange)
             {
                 ListItem item = new ListItem(base2.DisplayTitle, base2.ID);
                 if (string.Equals(base2.ID, this._selectedZoneID, StringComparison.OrdinalIgnoreCase))
                 {
                     item.Selected = true;
                 }
                 list.Items.Add(item);
             }
         }
     }
     base.LabelStyle.AddAttributesToRender(writer, this);
     if (list.Items.Count > 0)
     {
         writer.AddAttribute(HtmlTextWriterAttribute.For, list.ClientID);
     }
     writer.RenderBeginTag(HtmlTextWriterTag.Label);
     writer.Write(this.SelectTargetZoneText);
     writer.RenderEndTag();
     writer.Write(" ");
     list.ApplyStyle(base.EditUIStyle);
     if (list.Items.Count > 0)
     {
         list.RenderControl(writer);
     }
     writer.Write(" ");
     this.RenderVerbs(writer);
     writer.RenderEndTag();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:45,代码来源:CatalogZoneBase.cs


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