This documentation is archived and is not being maintained.
IAttributeAccessor.GetAttribute Method
.NET Framework 1.1
When implemented by a class, retrieves the specified attribute property from the server control.
[Visual Basic] Function GetAttribute( _ ByVal key As String _ ) As String [C#] string GetAttribute( string key ); [C++] String* GetAttribute( String* key ); [JScript] function GetAttribute( key : String ) : String;
Parameters
- key
- A String object that represents the name of the server control attribute.
Return Value
The value of the specified attribute.
Example
[Visual Basic, C#, C++] The following example demonstrates an implementation of the GetAttribute method.
[Visual Basic] ' Implement the GetAttribute method for the control. When ' this method is called from a page, the values for the control's ' properties can be displayed in the page. Public Function GetAttribute(name As String) As String Implements IAttributeAccessor.GetAttribute Return CType(ViewState(name), String) End Function 'GetAttribute [C#] // Implement the GetAttribute method for the control. When // this method is called from a page, the values for the control's // properties can be displayed in the page. public String GetAttribute(String name) { return (String)ViewState[name]; } [C++] // Implement the GetAttribute method for the control. When // this method is called from a page, the values for the control's // properties can be displayed in the page. public: String* GetAttribute(String* name) { return dynamic_cast<String*>(ViewState->Item[name]); }
[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button
in the upper-left corner of the page.
Requirements
Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family
See Also
IAttributeAccessor Interface | IAttributeAccessor Members | System.Web.UI Namespace
Show: