This documentation is archived and is not being maintained.

IAttributeAccessor.SetAttribute Method

When implemented by a class, designates an attribute and its value to assign to the ASP.NET server control.

Namespace: System.Web.UI
Assembly: System.Web (in system.web.dll)

void SetAttribute (
	string key,
	string value
)
void SetAttribute (
	String key, 
	String value
)
function SetAttribute (
	key : String, 
	value : String
)
Not applicable.

Parameters

key

The name of the attribute to be set.

value

The value assigned to the attribute.

The following code example demonstrates a possible implementation of the SetAttribute method.

// Implement the SetAttribute method for the control. When
// this method is called from a page, the control's properties
// are set to values defined in the page.
public void SetAttribute(String name, String value1)
{
   ViewState[name] = value1;
}

// Implement the SetAttribute method for the control. When
// this method is called from a page, the control's properties
// are set to values defined in the page.
public void SetAttribute(String name, String value1)
{
    this.get_ViewState().set_Item(name, value1);
} //SetAttribute

Windows 98, Windows Server 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0
Show: