This documentation is archived and is not being maintained.

AllowCustomAttributes Property

.NET Framework 1.1

Sets or returns whether or not controls on the page can have custom attributes defined. The default value is the value of the allowCustomAttributes attribute of the <mobilecontrols> section of the Web.config file.

public bool AllowCustomAttributes {


In addition to the IAttributeAccessor interface, the ASP.NET page framework provides a CustomAttributes dictionary that allows you to specify additional attributes, enable or disable custom attributing, or adjust a control's behavior or rendering.

To enable or disable custom attributing, you can either set the AllowCustomAttributes property to true, or you can set the allowCustomAttributes attribute of the <mobileControls> section of web.config to true.

Note   With custom attributes turned on, typographic errors in property names can be interpreted as custom attributes. For example, if a developer incorrectly specifies the Text property of a control as "Txet", the parser will save it as a custom attribute called "Txet", rather than raise an exception. Custom attributes are turned off by default as a precaution.


The following example demonstrates how to use the AllowCustomAttributes property to enable the custom accesskey attribute on the Command control.

<Mobile:Form runat=server id=frmTemplate >
<mobile:Command runat="server" id="cmd1" Text="No AccessKey" 
      accesskey="1" onClick="onClick">
      <Choice Filter="IsAccesskey" Text="1 is AccessKey"/>

      <filter name="IsAccesskey" compare="supportsAccesskeyAttribute" 
         argument="true" />        
   <sessionState cookieless="true" />
   <httpRuntime useFullyQualifiedRedirectUrl="true"/>
   <mobileControls allowCustomAttributes="True" />

See Also

Custom Attributes

Applies to: MobilePage Class