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.

實作

備註

使用方法來設定HtmlControl伺服器控制項上的屬性。 SetAttributeUse 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.

適用於

另請參閱