IAttributeAccessor.GetAttribute(String) 方法

定义

当由某个类实现时,检索服务器控件中指定的特性属性。

public string GetAttribute (string key);

参数

key
String

一个 String 对象,表示服务器控件特性的名称。

返回

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

适用于

产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8