IAttributeAccessor.SetAttribute(String, String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
当由类实现时,指定要分配给 ASP.NET 服务器控件的特性及其值。
public:
void SetAttribute(System::String ^ key, System::String ^ value);
public void SetAttribute (string key, string value);
abstract member SetAttribute : string * string -> unit
Public Sub SetAttribute (key As String, value As String)
参数
- key
- String
要设置的特性名称。
- value
- String
要分配给特性的值。
示例
下面的代码示例演示了方法的 SetAttribute 可能实现。
// 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 Sub SetAttribute(name As String, value1 As String) Implements IAttributeAccessor.SetAttribute
ViewState(name) = value1
End Sub