Class HtmlTag
Provides methods for render the Html elements
Inheritance
Inherited Members
Namespace: Syncfusion.JavaScript
Assembly: Syncfusion.EJ.dll
Syntax
public class HtmlTag
Constructors
HtmlTag(String)
Initializes a new instance of the HtmlTag class.
Declaration
public HtmlTag(string tagName)
Parameters
Type | Name | Description |
---|---|---|
System.String | tagName | Name of the tag. |
HtmlTag(String, TagRenderMode)
Initializes a new instance of the HtmlTag class.
Declaration
public HtmlTag(string tagName, TagRenderMode renderMode)
Parameters
Type | Name | Description |
---|---|---|
System.String | tagName | Name of the tag. |
TagRenderMode | renderMode | The render mode. |
HtmlTag(String, Action<HtmlTag>)
Initializes a new instance of the HtmlTag class.
Declaration
public HtmlTag(string tagName, Action<HtmlTag> configure)
Parameters
Type | Name | Description |
---|---|---|
System.String | tagName | Name of the tag. |
System.Action<HtmlTag> | configure | The configure. |
Properties
ChildElements
Gets or sets the child elements.
Declaration
public List<HtmlTag> ChildElements { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<HtmlTag> | The child elements. |
RenderMode
Gets or sets the render mode.
Declaration
public TagRenderMode RenderMode { get; set; }
Property Value
Type | Description |
---|---|
TagRenderMode | The render mode. |
Template
Gets or sets the template.
Declaration
public Action<TextWriter> Template { get; set; }
Property Value
Type | Description |
---|---|
System.Action<System.IO.TextWriter> | The template. |
Methods
Add(HtmlTag)
Used to Add the specified child to the current instance.
Declaration
public HtmlTag Add(HtmlTag child)
Parameters
Type | Name | Description |
---|---|---|
HtmlTag | child | The child. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Add(IEnumerable<HtmlTag>)
Adds the specified childs.
Declaration
public HtmlTag Add(IEnumerable<HtmlTag> childs)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<HtmlTag> | childs | The childs. |
Returns
Type | Description |
---|---|
HtmlTag |
Add(String)
Adds the specified tag.
Declaration
public HtmlTag Add(string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag. |
Returns
Type | Description |
---|---|
HtmlTag |
Add(String, Action<HtmlTag>)
Used to Add the specified child to the current instance and configure the child element.
Declaration
public HtmlTag Add(string tag, Action<HtmlTag> configure)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag. |
System.Action<HtmlTag> | configure | The action. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
AddClass(String)
Adds the specified CSS class to the tag-builder attributes.
Declaration
public HtmlTag AddClass(string className)
Parameters
Type | Name | Description |
---|---|---|
System.String | className | Name of the class. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
AddClasses(List<String>)
Adds the list of CSS classes to the tag-builder attributes
Declaration
public HtmlTag AddClasses(List<string> classes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<System.String> | classes | The classes. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
AddClasses(String[])
Adds the array of CSS classes to the tag-builder attributes
Declaration
public HtmlTag AddClasses(params string[] classes)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | classes | The classes. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
AddTemplate(Action<TextWriter>)
Declaration
public HtmlTag AddTemplate(Action<TextWriter> template)
Parameters
Type | Name | Description |
---|---|---|
System.Action<System.IO.TextWriter> | template |
Returns
Type | Description |
---|---|
HtmlTag |
Attributes()
Attributeses this instance.
Declaration
public IDictionary<string, string> Attributes()
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> | attribute collection |
Attributes(Object)
Attributeses the specified attributes.
Declaration
public HtmlTag Attributes(object attributes)
Parameters
Type | Name | Description |
---|---|---|
System.Object | attributes | The attributes. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Attributes(String, String)
Adds an attribute to the tag by using the specified key/value pair.
Declaration
public HtmlTag Attributes(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
System.String | value | The value. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Attributes(String, String, Boolean)
Adds an attribute to the tag by using the specified key/value pair
Declaration
public HtmlTag Attributes(string key, string value, bool replaceExisting)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
System.String | value | The value. |
System.Boolean | replaceExisting | if set to |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Attributes<TKey, TValue>(IDictionary<TKey, TValue>)
Attributeses the specified attributes.
Declaration
public HtmlTag Attributes<TKey, TValue>(IDictionary<TKey, TValue> attributes)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TKey, TValue> | attributes | The attributes. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Type Parameters
Name | Description |
---|---|
TKey | The type of the key. |
TValue | The type of the value. |
Attributes<TKey, TValue>(IDictionary<TKey, TValue>, Boolean)
Adds an attribute to the specified collection of attributes for the tag
Declaration
public HtmlTag Attributes<TKey, TValue>(IDictionary<TKey, TValue> attributes, bool replaceExisting)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IDictionary<TKey, TValue> | attributes | The attributes. |
System.Boolean | replaceExisting | if set to |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Type Parameters
Name | Description |
---|---|
TKey | The type of the key. |
TValue | The type of the value. |
ChildElement<T>()
Used to add the Childs the element to current instance.
Declaration
public T ChildElement<T>()
where T : HtmlTag, new()
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T | Model |
FirstChild()
Used to get the First child element
Declaration
public HtmlTag FirstChild()
Returns
Type | Description |
---|---|
HtmlTag | First child element |
GetAttribute(String)
Gets the attribute.
Declaration
public string GetAttribute(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
Returns
Type | Description |
---|---|
System.String | attribute value |
GetInnerHtml()
Gets the inner HTML.
Declaration
public string GetInnerHtml()
Returns
Type | Description |
---|---|
System.String |
Hide()
Hides this instance.
Declaration
public HtmlTag Hide()
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Html(String)
HTMLs the specified value.
Declaration
public HtmlTag Html(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Id(String)
Used to set the ID attribute to Html element
Declaration
public HtmlTag Id(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | The element id. |
Returns
Type | Description |
---|---|
HtmlTag | HtmlTag |
InsertAt(Int32, HtmlTag)
Used to insert the child element to specified position.
Declaration
public void InsertAt(int index, HtmlTag tag)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The index. |
HtmlTag | tag | The tag. |
InsertFirst(HtmlTag)
Used to insert the child element to first position.
Declaration
public void InsertFirst(HtmlTag tag)
Parameters
Type | Name | Description |
---|---|---|
HtmlTag | tag | The tag. |
Modify(Action<HtmlTag>)
Used to Modifies the current instance
Declaration
public HtmlTag Modify(Action<HtmlTag> configure)
Parameters
Type | Name | Description |
---|---|---|
System.Action<HtmlTag> | configure | The Action. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Prepend(String)
Prepends the specified text.
Declaration
public HtmlTag Prepend(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
Render(TextWriter)
Renders the specified writer.
Declaration
public void Render(TextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextWriter | writer | The writer. |
Style(String, String)
Styles the specified key.
Declaration
public HtmlTag Style(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key. |
System.String | value | The value. |
Returns
Type | Description |
---|---|
HtmlTag |
TagName()
Used to return Tags the name.
Declaration
public string TagName()
Returns
Type | Description |
---|---|
System.String | TagName of the TagBuilder |
Text(String)
Texts the specified value.
Declaration
public HtmlTag Text(string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | value | The value. |
Returns
Type | Description |
---|---|
HtmlTag | Current HtmlTag instance |
ToString()
Returns a System.String that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A System.String that represents this instance. |