HtmlHelper.AttributeEncode Method (Object)

Returns an HTML-encoded string that represents the specified object by using a minimal encoding that is suitable only for HTML attributes that are enclosed in quotation marks.

Namespace:  System.Web.WebPages.Html
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)

Syntax

'Declaration
Public Function AttributeEncode ( _
    value As Object _
) As String
'Usage
Dim instance As HtmlHelper 
Dim value As Object 
Dim returnValue As String 

returnValue = instance.AttributeEncode(value)
public string AttributeEncode(
    Object value
)
public:
String^ AttributeEncode(
    Object^ value
)
member AttributeEncode : 
        value:Object -> string
public function AttributeEncode(
    value : Object
) : String

Parameters

Return Value

Type: System.String
An HTML-encoded string that represents the object.

Remarks

To facilitate encoding, the specified object is first converted to an unencoded string by calling its ToString method with the InvariantCulture enumeration. This string representation of the object is then encoded and returned.

Minimal HTML-encoding converts only double-quotation ("), ampersand (&), and less-than (<) characters to their corresponding HTML escape sequences. This is faster than full HTML encoding, but is suitable only for encoding HTML attributes that are in double quotation marks.

See Also

Reference

HtmlHelper Class

AttributeEncode Overload

System.Web.WebPages.Html Namespace