ScriptManager.RegisterExpandoAttribute 方法

定義

將名稱/值對註冊為 ScriptManager 指定控制項的自訂(展開)屬性。

public:
 static void RegisterExpandoAttribute(System::Web::UI::Control ^ control, System::String ^ controlId, System::String ^ attributeName, System::String ^ attributeValue, bool encode);
public static void RegisterExpandoAttribute(System.Web.UI.Control control, string controlId, string attributeName, string attributeValue, bool encode);
static member RegisterExpandoAttribute : System.Web.UI.Control * string * string * string * bool -> unit
Public Shared Sub RegisterExpandoAttribute (control As Control, controlId As String, attributeName As String, attributeValue As String, encode As Boolean)

參數

control
Control

就是負責註冊 expando 屬性的控制項。

controlId
String

包含頁面自訂屬性的控制項。

attributeName
String

要註冊的自訂屬性名稱。

attributeValue
String

自訂屬性的值。

encode
Boolean

true編碼正在註冊的自訂屬性;否則,。 false

例外狀況

controlnull

control 不在頁面的控制樹中。

-或-

controlIdnull

-或-

controlId 空無一人。

-或-

attributeNamenull

-或-

attributeName 空無一人。

-或-

attributeName 已經註冊了。

備註

你可以使用 RegisterExpandoAttribute 方法註冊一個自訂(展開)屬性,該屬性適用於相容於部分頁面渲染且沒有 Microsoft Ajax 函式庫依賴。

此方法會 RegisterExpandoAttribute 註冊一對名稱/值對,作為指定控制項的自訂屬性。 此屬性由 ECMAScript(JavaScript)動態設定,以保留渲染控制項標記的 XHTML 相容性。 如果你必須跳脫動態屬性值中的任何字元,請設定 encodetrue

若找不到將加入動態屬性的控制項,則會發生腳本錯誤。

適用於

另請參閱