Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

TagBuilder Class

Contains classes and properties that are used to create HTML elements. This class is used to write helpers, such as those found in the System.Web.Helpers namespace.

System.Object
  System.Web.Mvc.TagBuilder

Namespace:  System.Web.Mvc
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)
public class TagBuilder

The TagBuilder type exposes the following members.

  NameDescription
Public methodTagBuilderCreates a new tag that has the specified tag name.
Top
  NameDescription
Public propertyAttributesGets the collection of attributes.
Public propertyIdAttributeDotReplacementGets or sets a string that can be used to replace invalid HTML characters.
Public propertyInnerHtmlGets or sets the inner HTML value for the element.
Public propertyTagNameGets the tag name for this tag.
Top
  NameDescription
Public methodAddCssClassAdds a CSS class to the list of CSS classes in the tag.
Public methodStatic memberCreateSanitizedId(String)Replaces each invalid character in the tag ID with a valid HTML character.
Public methodStatic memberCreateSanitizedId(String, String)Replaces each invalid character in the tag ID with the specified replacement string.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGenerateIdGenerates a sanitized ID attribute for the tag by using the specified name.
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodMergeAttribute(String, String)Adds a new attribute to the tag.
Public methodMergeAttribute(String, String, Boolean)Adds a new attribute or optionally replaces an existing attribute in the opening tag.
Public methodMergeAttributes<TKey, TValue>(IDictionary<TKey, TValue>)Adds new attributes to the tag.
Public methodMergeAttributes<TKey, TValue>(IDictionary<TKey, TValue>, Boolean)Adds new attributes or optionally replaces existing attributes in the tag.
Public methodSetInnerTextSets the InnerHtml property of the element to an HTML-encoded version of the specified string.
Public methodToString()Renders the element as a Normal element. (Overrides Object.ToString().)
Public methodToString(TagRenderMode)Renders the HTML tag by using the specified render mode.
Top
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.