本文整理汇总了C#中System.Web.UI.HtmlTextWriter.RenderSelfClosingTag方法的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriter.RenderSelfClosingTag方法的具体用法?C# HtmlTextWriter.RenderSelfClosingTag怎么用?C# HtmlTextWriter.RenderSelfClosingTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.UI.HtmlTextWriter
的用法示例。
在下文中一共展示了HtmlTextWriter.RenderSelfClosingTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoRender
/// <summary>
/// Renders the output of the control
/// </summary>
/// <param name="output">The response writer.</param>
protected override void DoRender(HtmlTextWriter output)
{
// <link rel="stylesheet" media="screen" type="text/css" href="/css/ie8.css">
var attributes = new List<HtmlAttribute>();
attributes.Add(new HtmlAttribute(HtmlTextWriterAttribute.Href, this.GetAbsoluteUrl(this.Href)));
if (!string.IsNullOrEmpty(this.Rel))
{
attributes.Add(new HtmlAttribute(HtmlTextWriterAttribute.Rel, this.Rel));
}
if (!string.IsNullOrEmpty(this.Media))
{
attributes.Add(new HtmlAttribute("media", this.Media));
}
// ReSharper disable CSharpWarnings::CS0612
if (!string.IsNullOrEmpty(this.LinkType))
{
attributes.Add(new HtmlAttribute(HtmlTextWriterAttribute.Type, this.LinkType));
}
// ReSharper restore CSharpWarnings::CS0612
output.RenderSelfClosingTag(HtmlTextWriterTag.Link, attributes.ToArray());
}
示例2: DoRender
/// <summary>
/// Builds the jquery-tokeninput control.
/// </summary>
/// <param name="output">The HtmlTextWriter control used to output the control.</param>
protected override void DoRender(HtmlTextWriter output)
{
var fieldValue = string.Empty;
if (!string.IsNullOrEmpty(this.Value))
{
var list = new ListString(this.Value);
fieldValue = string.Join("|", list.Items);
}
var controlId = "{0}_Value".FormatWith(ID);
output.RenderSelfClosingTag(
HtmlTextWriterTag.Input,
new HtmlAttribute("id", controlId),
new HtmlAttribute("style", "width:100%"),
new HtmlAttribute("value", fieldValue));
if (this.Source.StartsWith("lucene:", StringComparison.InvariantCultureIgnoreCase))
{
this.RenderServiceOptions(output, this.Source, controlId);
}
else
{
this.RenderManualOptions(output, this.Source, controlId);
}
}