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


C# HtmlTextWriterTag类代码示例

本文整理汇总了C#中HtmlTextWriterTag的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriterTag类的具体用法?C# HtmlTextWriterTag怎么用?C# HtmlTextWriterTag使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: AddTag

 public static void AddTag(this HtmlTextWriter writer, HtmlTextWriterTag tag,
     string value = "")
 {
     writer.RenderBeginTag(tag);
     writer.Write(value != "" ? value : Environment.NewLine);
     writer.RenderEndTag();
 }
开发者ID:TomDrJones,项目名称:NUnitGo,代码行数:7,代码来源:HtmlTextWriterExtensions.cs

示例2: Full

 public static HtmlTextWriter Full(this HtmlTextWriter writer, HtmlTextWriterTag tag, string content = "")
 {
     writer.RenderBeginTag(tag);
     writer.Write(content);
     writer.RenderEndTag();
     return writer;
 }
开发者ID:poulfoged,项目名称:little-convoy,代码行数:7,代码来源:HtmlTextWriterExtensions.cs

示例3: BuildOneTag

        internal static string BuildOneTag(string virtualPath, HtmlTextWriterTag tag)
        {
            TagRenderMode tagRenderMode;

            var tagBuilder = new TagBuilder(tag.ToString().ToLower());

            var absolutePath = VirtualPathUtility.ToAbsolute(virtualPath);
            switch (tag)
            {
                case HtmlTextWriterTag.Script:
                    tagRenderMode = TagRenderMode.Normal;
                    tagBuilder.MergeAttribute("type", "text/javascript");
                    tagBuilder.MergeAttribute("src", absolutePath);
                    break;
                case HtmlTextWriterTag.Link:
                    tagRenderMode = TagRenderMode.SelfClosing;
                    tagBuilder.MergeAttribute("type", "text/css");
                    tagBuilder.MergeAttribute("media", "all"); //always ALL?
                    tagBuilder.MergeAttribute("rel", "stylesheet");
                    tagBuilder.MergeAttribute("href", absolutePath);
                    break;
                default:
                    throw new InvalidOperationException();
            }

            return tagBuilder.ToString(tagRenderMode);
        }
开发者ID:junalmeida,项目名称:dotnet35-weboptimizations,代码行数:27,代码来源:AssetManager.cs

示例4: RenderTag

 public void RenderTag(HtmlTextWriterTag tagKey, string html)
 {
     RenderBeginTag(tagKey);
     if (!string.IsNullOrEmpty(html))
         Write(html);
     RenderEndTag();
 }
开发者ID:siranen,项目名称:SystemSnapshotWebServer,代码行数:7,代码来源:HtmlTextWritterEx.cs

示例5: RenderTag

        public static IDisposable RenderTag([NotNull] this HtmlTextWriter writer, HtmlTextWriterTag tag)
        {
            if (writer == null) throw new ArgumentNullException("writer");

            writer.RenderBeginTag(tag);
            return new DisposableAction(writer.RenderEndTag);
        }
开发者ID:devhost,项目名称:Corelicious,代码行数:7,代码来源:HtmlTextWriterExtensions.cs

示例6: HtmlTag

		/// <summary>
		/// Initializes a new instance of the HtmlTag class. Renders the opening tag of an HTML node, including any attributes.
		/// </summary>
		/// <param name="writer">
		/// The HTMLTextWriter.
		/// </param>
		/// <param name="tag">
		/// The type of HTML tag.
		/// </param>
		/// <param name="style">
		/// The style.
		/// </param>
		/// <param name="attributes">
		/// HTML attributes.
		/// </param>
		public HtmlTag(HtmlTextWriter writer, HtmlTextWriterTag tag, TagStyle style, params HtmlAttribute[] attributes)
		{
			this.writer = writer;
			this.attributes = attributes;
			this.tag = tag.ToString().ToLower();
			this.tagStyle = style;
			this.StartRender();
		}
开发者ID:sitecorerick,项目名称:constellation.html,代码行数:23,代码来源:HtmlTag.cs

示例7: InsertText

        /// <summary>
        /// Write text inside tags of type HtmlTextWriterTag
        /// </summary>
        /// <param name="html">HtmlTextWriter instance object</param>
        /// <param name="value">Input text / string</param>
        /// <param name="tag">Value of HtmlTextWriterTag enumaration</param>
        /// <returns>HtmlTextWriter reference</returns>
        public static HtmlTextWriter InsertText(this HtmlTextWriter html, string value, HtmlTextWriterTag tag)
        {
            CheckNullParam(html);

            html.WriteBeginTag(tag.ToString());
            html.Write(HtmlTextWriter.TagRightChar);
            html.Write(value);
            html.WriteEndTag(tag.ToString());

            return html;
        }
开发者ID:targitaj,项目名称:m3utonetpaleyerxml,代码行数:18,代码来源:HtmlTextWritterExtender.cs

示例8: BuildTags

        internal static MvcHtmlString BuildTags(string[] virtualPaths, HtmlTextWriterTag tag)
        {
            var builder = new StringBuilder();

            foreach (var virtualPath in virtualPaths)
            {
                var urls = ResolveUrls(virtualPath);
                foreach (var url in urls)
                    builder.AppendLine(BuildOneTag(url, tag));
            }

            return MvcHtmlString.Create(builder.ToString());
        }
开发者ID:junalmeida,项目名称:dotnet35-weboptimizations,代码行数:13,代码来源:AssetManager.cs

示例9: Test

		private void Test(ref HtmlTextWriterTag testTag)
		{
			try
			{
				this.GHTSubTestBegin("Tag = " + ((HtmlTextWriterTag) testTag).ToString());
				WebControl control1 = new WebControl(testTag);
				this.m_ctrlCounter++;
				control1.ID = "ctrl_" + this.m_ctrlCounter.ToString();
				base.GHTActiveSubTest.Controls.Add(control1);
			}
			catch (Exception exception2)
			{
				// ProjectData.SetProjectError(exception2);
				Exception exception1 = exception2;
				this.GHTSubTestUnexpectedExceptionCaught(exception1);
				// ProjectData.ClearProjectError();
			}
			this.GHTSubTestEnd();
		}
开发者ID:nobled,项目名称:mono,代码行数:19,代码来源:WebControl_ctor_H.aspx.cs

示例10: WebControl

		public WebControl (HtmlTextWriterTag tag) 
		{
			this.tag = tag;
			this.enabled = true;
		}
开发者ID:runefs,项目名称:Marvin,代码行数:5,代码来源:WebControl.cs

示例11: RenderElement

 internal static void RenderElement(this HtmlTextWriter writer, HtmlTextWriterTag tag, string format, params object[] arg)
 {
     writer.RenderBeginTag(tag);
     writer.Write(format, arg);
     writer.RenderEndTag();
 }
开发者ID:midspace,项目名称:SEToolbox,代码行数:6,代码来源:HtmlExtensions.cs

示例12: RenderBeginTag

		public override void RenderBeginTag (HtmlTextWriterTag tagKey)
		{
                        base.RenderBeginTag (tagKey);
		}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:4,代码来源:Html32TextWriter.cs

示例13: ScriptControlBase

        /// <summary>
		/// 构造函数
        /// Initializes a new ScriptControl
        /// </summary>
		/// <param name="enableClientState">是否使用ClientState</param>
		/// <param name="tag">控件的HtmlTextWriterTag</param>
        protected ScriptControlBase(bool enableClientState, HtmlTextWriterTag tag)
        {
            _tagKey = tag;
            _enableClientState = enableClientState;		
        }
开发者ID:jerryshi2007,项目名称:AK47Source,代码行数:11,代码来源:ScriptControlBase.cs

示例14: RenderBeginTag

        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public override void RenderBeginTag(HtmlTextWriterTag tagKey) {
            // flush string buffers to build new tag
            _beforeTag.Length = 0;
            _beforeContent.Length = 0;
            _afterContent.Length = 0;
            _afterTag.Length = 0;

            _renderFontTag = false;
            _fontFace = null;
            _fontColor = null;
            _fontSize = null;

            // div->table substitution.
            if (ShouldPerformDivTableSubstitution) {
                if (tagKey == HtmlTextWriterTag.Div) {
                    AppendOtherTag("tr", _beforeContent, _afterContent);

                    string alignment;
                    if (IsAttributeDefined(HtmlTextWriterAttribute.Align, out alignment)) {
                        string[] attribs = new string[] { GetAttributeName(HtmlTextWriterAttribute.Align), alignment};

                        AppendOtherTag("td", new object[]{ attribs}, _beforeContent, _afterContent);
                    }
                    else {
                        AppendOtherTag("td", _beforeContent, _afterContent);
                    }
                    if (!IsAttributeDefined(HtmlTextWriterAttribute.Cellpadding)) {
                        AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                    }
                    if (!IsAttributeDefined(HtmlTextWriterAttribute.Cellspacing)) {
                        AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                    }
                    if (!IsStyleAttributeDefined(HtmlTextWriterStyle.BorderWidth)) {
                        AddAttribute(HtmlTextWriterAttribute.Border, "0");
                    }
                    if (!IsStyleAttributeDefined(HtmlTextWriterStyle.Width)) {
                        AddAttribute(HtmlTextWriterAttribute.Width, "100%");
                    }
                }
            }

            base.RenderBeginTag(tagKey);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:46,代码来源:Html32TextWriter.cs

示例15: OnTagRender

        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        protected override bool OnTagRender(string name, HtmlTextWriterTag key) {
            // handle any tags that do not work downlevel

            SetTagSupports();
            if (Supports(FONT_PROPAGATE)) {
                FontStack.Push(new FontStackItem());
            }

            // div->table substitution.
            // Make tag look like a table. This must be done after we establish tag support.
            if (key == HtmlTextWriterTag.Div && ShouldPerformDivTableSubstitution) {
                TagKey = HtmlTextWriterTag.Table;
            }

            return base.OnTagRender(name,key);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:19,代码来源:Html32TextWriter.cs


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