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