HtmlControl.SetAttribute(String, String) 方法

定义

设置 HtmlControl 控件的命名特性的值。Sets the value of the named attribute on the HtmlControl control.

protected:
 virtual void SetAttribute(System::String ^ name, System::String ^ value);
protected virtual void SetAttribute (string name, string value);
abstract member SetAttribute : string * string -> unit
override this.SetAttribute : string * string -> unit
Protected Overridable Sub SetAttribute (name As String, value As String)

参数

name
String

要设置的特性的名称。The name of the attribute to set.

value
String

要设置的属性的值。The value to set the attribute to.

实现

注解

使用 SetAttribute 方法可在 HtmlControl 服务器控件上设置属性。Use the SetAttribute method to set an attribute on the HtmlControl server control. 所有 HTML 服务器控件都将其属性存储在 Control.ViewState 属性中。All HTML server controls store their attributes in the Control.ViewState property.

HTML 特性由 ASP.NET 页框架作为它们所属的 HTML 服务器控件上的属性进行处理。HTML attributes are treated by the ASP.NET page framework as properties on the HTML server control to which they belong. SetAttribute 方法的 name 参数不区分大小写。The SetAttribute method's name parameter is case-insensitive.

适用于

另请参阅