IAttributeAccessor.GetAttribute(String) 方法

定義

當由類別實作時,會從伺服器控制項取得指定的屬性屬性。

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

A String 代表伺服器控制屬性的名稱。

傳回

指定屬性的值。

範例

以下程式碼範例展示了該 GetAttribute 方法的實作。

// 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

適用於