ScriptManager.RegisterExpandoAttribute 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
在 ScriptManager 控件中,将名称/值对注册为指定控件的自定义 (expando) 特性。
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。
例外
control 为 null。
control 不在该页面的控件树中。
或 -
controlId上声明的默认值为null。或 -
controlId为空。或 -
attributeName上声明的默认值为null。或 -
attributeName为空。或 - 已注册
attributeName。
注解
可以使用此方法 RegisterExpandoAttribute 为与分页呈现兼容的控件注册自定义 (expando) 属性,并且该控件没有 Microsoft Ajax 库依赖项。
该方法RegisterExpandoAttribute将名称/值注册为指定控件的自定义属性配对。 此属性从 ECMAScript (JavaScript) 动态设置,以保留呈现控件标记的 XHTML 兼容性。 Set encode to true if you have to escape any characters in the dynamic property's value.
如果未找到要向其添加动态属性的控件,则会发生脚本错误。