HtmlElement.SetAttribute Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Sets the value of an attribute on the current HTML element.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
Public Sub SetAttribute ( _
    name As String, _
    value As String _
)
public void SetAttribute(
    string name,
    string value
)

Parameters

  • name
    Type: System.String
    The attribute whose value will be set.

Exceptions

Exception Condition
ArgumentException

name is an empty string.

ArgumentNullException

name is nulla null reference (Nothing in Visual Basic).

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.