HtmlHelper.Label HtmlHelper.Label HtmlHelper.Label Method

Definition

Overloads

Label(String) Label(String) Label(String)

Returns an HTML label that displays the specified text.

Label(String, Object) Label(String, Object) Label(String, Object)

Returns an HTML label that displays the specified text and that has the specified custom attributes.

Label(String, String) Label(String, String) Label(String, String)

Returns an HTML label that displays the specified text and that has the specified for attribute.

Label(String, String, IDictionary<String,Object>) Label(String, String, IDictionary<String,Object>) Label(String, String, IDictionary<String,Object>)

Returns an HTML label that displays the specified text, and that has the specified for attribute and custom attributes defined by an attribute dictionary.

Label(String, String, Object) Label(String, String, Object) Label(String, String, Object)

Returns an HTML label that displays the specified text, and that has the specified for attribute and custom attributes defined by an attribute object.

Label(String) Label(String) Label(String)

Returns an HTML label that displays the specified text.

public System.Web.IHtmlString Label (string labelText);
member this.Label : string -> System.Web.IHtmlString
Public Function Label (labelText As String) As IHtmlString
Parameters
labelText
String String String

The text to display.

Returns

The HTML markup that represents the label.

Exceptions
Sytem.ArgumentException Sytem.ArgumentException Sytem.ArgumentException

labelText is null or empty.

Label(String, Object) Label(String, Object) Label(String, Object)

Returns an HTML label that displays the specified text and that has the specified custom attributes.

public System.Web.IHtmlString Label (string labelText, object attributes);
member this.Label : string * obj -> System.Web.IHtmlString
Public Function Label (labelText As String, attributes As Object) As IHtmlString
Parameters
labelText
String String String

The text to display.

attributes
Object Object Object

An object that contains custom attributes for the element. The attribute names and values are retrieved through reflection by examining the properties of the object.

Returns

The HTML markup that represents the label.

Exceptions
Sytem.ArgumentException Sytem.ArgumentException Sytem.ArgumentException

labelText is null or empty.

Label(String, String) Label(String, String) Label(String, String)

Returns an HTML label that displays the specified text and that has the specified for attribute.

public System.Web.IHtmlString Label (string labelText, string labelFor);
member this.Label : string * string -> System.Web.IHtmlString
Public Function Label (labelText As String, labelFor As String) As IHtmlString
Parameters
labelText
String String String

The text to display.

labelFor
String String String

The value to assign to the for attribute of the HTML control element.

Returns

The HTML markup that represents the label.

Exceptions
Sytem.ArgumentException Sytem.ArgumentException Sytem.ArgumentException

labelText is null or empty.

Label(String, String, IDictionary<String,Object>) Label(String, String, IDictionary<String,Object>) Label(String, String, IDictionary<String,Object>)

Returns an HTML label that displays the specified text, and that has the specified for attribute and custom attributes defined by an attribute dictionary.

public System.Web.IHtmlString Label (string labelText, string labelFor, System.Collections.Generic.IDictionary<string,object> attributes);
member this.Label : string * string * System.Collections.Generic.IDictionary<string, obj> -> System.Web.IHtmlString
Public Function Label (labelText As String, labelFor As String, attributes As IDictionary(Of String, Object)) As IHtmlString
Parameters
labelText
String String String

The text to display.

labelFor
String String String

The value to assign to the for attribute of the HTML control element.

attributes
IDictionary<String,Object>

The names and values of custom attributes for the element.

Returns

The HTML markup that represents the label.

Exceptions
Sytem.ArgumentException Sytem.ArgumentException Sytem.ArgumentException

labelText is null or empty.

Label(String, String, Object) Label(String, String, Object) Label(String, String, Object)

Returns an HTML label that displays the specified text, and that has the specified for attribute and custom attributes defined by an attribute object.

public System.Web.IHtmlString Label (string labelText, string labelFor, object attributes);
member this.Label : string * string * obj -> System.Web.IHtmlString
Public Function Label (labelText As String, labelFor As String, attributes As Object) As IHtmlString
Parameters
labelText
String String String

The text to display.

labelFor
String String String

The value to assign to the for attribute of the HTML control element.

attributes
Object Object Object

An object that contains custom attributes for the element. The attribute names and values are retrieved through reflection by examining the properties of the object.

Returns

The HTML markup that represents the label.

Exceptions
Sytem.ArgumentException Sytem.ArgumentException Sytem.ArgumentException

labelText is null or empty.

Applies to