Show navigation | Frontpage | Contact us | Sitemap

Specifying custom attributes on your User Control

All parameters specified on a $$USERCONTROL(path=...); Identifier is passed along to the ASP.NET User Control as attributes.

Consider the following declaration:

$$USERCONTROL( Path=ThumbGallery.ascx, ListSize=4, ImgWidth=150 );

This will load the user control "/UserControls/ThumbGallery.ascx" and append the following named attributes to it:

  • ListSize = "4"
  • ImgWidth = "150"

To reference the values from within your User Control, simply use the following:

  • Attributes[ "ListSize" ]
  • Attributes[ "ImgWidth" ]

The total length of the identifier, including $$USERCONTROL(path=...);, may not exceed 256 characters. 

For more information try this sample User Control.

My modules


© 2008 Composite A/S, Danmark
Tlf: +45 39 15 76 00 | info@composite.net
Composite A/S er Microsoft Certified Partner
Composite CMS overholder standarden for valid CSS
Composite CMS overholder standarden for valid XHTML 1.0
Printet fra http://www.composite.net/composite-1588.htm
Findes på denne sti: Composite Developer | 3.x technologies | ASP.NET | Embedding ASP.NET User Controls | Specifying custom attributes