IAttributeAccessor.GetAttribute(String) 方法

定义

当由某个类实现时,检索服务器控件中指定的特性属性。When implemented by a class, retrieves the specified attribute property from the server control.

public:
 System::String ^ GetAttribute(System::String ^ key);
public string GetAttribute (string key);
abstract member GetAttribute : string -> string
Public Function GetAttribute (key As String) As String

参数

key
String

一个 String 对象,表示服务器控件特性的名称。A String that represents the name of the server control attribute.

返回

指定的属性的值。The value of the specified attribute.

示例

下面的代码示例演示GetAttribute方法的实现。The following code example demonstrates an implementation of the GetAttribute method.

// 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];
}
' 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

适用于