本文整理汇总了C#中TagBuilder.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TagBuilder.Add方法的具体用法?C# TagBuilder.Add怎么用?C# TagBuilder.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagBuilder
的用法示例。
在下文中一共展示了TagBuilder.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoRender
/// <summary>
/// Sends server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter"></see> object, which writes the content to be rendered on the client.
/// </summary>
/// <param name="output">The <see cref="T:System.Web.UI.HtmlTextWriter"></see> object that receives the server control content.</param>
protected override void DoRender(HtmlTextWriter output) {
Item current = Client.GetItemNotNull(ItemID, Sitecore.Context.ContentDatabase);
IList<Item> items = GetItems(current, Source);
var list = new TagBuilder("div") {ID = ID, Class = "scTextlist"};
if(Disabled) {
list.Add("disabled", "true");
}
list.Start(output);
output.Write("<div id='{0}_list' class='textlist-list'>".FormatWith(ID));
RenderValue(output);
output.Write("</div>");
output.Write("<div class='textlist-autocomplete' style='display:none'></div>");
output.Write("<div class='textlist-choices' style='display:none'>");
foreach(Item item in items) {
output.Write("<span sc_text=\"{0}\" sc_value='{1}'>{0}</span>".FormatWith(item.DisplayName, item.ID));
}
output.Write("</div>");
output.Write("</div>");
output.Write("<input type='hidden' id='{0}' value='{1}' />".FormatWith(ID + "_value", Value));
output.Write("<link rel=Stylesheet type='text/css' href='/sitecore%20modules/outercore.fieldtypes/textlist/js/textlist.css' />");
string script = "new Sitecore.FieldTypes.TextList('{0}');".FormatWith(ID);
script = "<script type='text/javascript' language='javascript'>" + script + "</script>";
output.Write(script);
}