Registers a name/value pair with the ScriptManager control as a custom (expando) attribute of a specified control.
Syntax
CSharp
VisualBasic
Public Shared Sub RegisterExpandoAttribute ( _
control As Control, _
controlId As String, _
attributeName As String, _
attributeValue As String, _
encode As Boolean _
)
ManagedCPlusPlus
JSharp
Parameters
- control (Control)
The control that is registering the expando attribute.
- controlId (String)
The Control instance that contains the custom attribute on the page.
- attributeName (String)
The name of the custom attribute to register.
- attributeValue (String)
The value of the custom attribute to register.
- encode (Boolean)
A Boolean value that indicates whether to encode the custom attribute that is being registered.
Remarks
The RegisterExpandoAttribute(Control, String, String, String, Boolean) method is used to register a custom (expando) property for a control that is compatible with partial-page rendering and that has no Microsoft AJAX Library dependencies.
The RegisterExpandoAttribute(Control, String, String, String, Boolean) method registers a name/value pair as a custom (or expando) attribute on the specified control. The property is set dynamically from ECMAScript (JavaScript) to preserve XHTML compatibility for the rendered control's markup. Set the encode parameter to true if you need to escape any characters in the dynamic property's value.
If the control to which the dynamic property will be added is not found, a script error occurs.
Exceptions
| Exception | Condition |
|---|
| ArgumentNullException | control is null. |
| ArgumentException | control is not in the page's control tree. - or - controlId is null. - or - controlId is empty. - or - attributeName is null. - or - attributeName is empty. - or - attributeName is already registered. |
Assembly: System.Web.Extensions (Module: System.Web.Extensions)