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


C# HtmlTextWriter.RenderSelfClosingTag方法代码示例

本文整理汇总了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());
		}
开发者ID:sitecorerick,项目名称:constellation.sitecore.seo,代码行数:30,代码来源:StaticCssReference.cs

示例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);
            }
        }
开发者ID:WizX20,项目名称:spark-sitecore-client,代码行数:31,代码来源:TokenizedList.cs


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