Parse-Time Attributes


These attributes are used by the page parser to parse the syntax of an .aspx page and generate code for the class that corresponds to the page.

Table A-17. System.Web.UI.ControlBuilderAttribute

Summary

Associates a custom control builder with a control.

Applied to

Controls

Sample usage

[ControlBuilder(typeof(InnerTextLabelControlBuilder))]

Example

The InnerTextLabel control in Listing 12-10

Remarks

The ControlBuilder class is associated with the base Control class and thus with every server control. Apply ControlBuilderAttribute only if you want to associate a custom control builder with your control.

Table A-18. System.Web.UI.ParseChildrenAttribute  

Summary

Informs the parser whether to interpret the nested content within a control's tag as properties or as child controls.

Applied to

Controls

Sample usage

[ParseChildren(true)]

or

[ParseChildren(true, "HotSpots")]

Example

The ImageMap control in Listing 10-13

Remarks

The constructor takes in a Boolean value that indicates whether the parser should parse nested content as properties. Control is not marked with this attribute, which implies that the parser treats nested content as child controls. WebControl is marked with ParseChildren(true) . Therefore, the parser treats nested content as properties. You can override the parsing logic associated with the base class by reapplying this attribute to your control.

The two-parameter form of this attribute takes in a property name as its second argument. When the two-parameter form is used, the nested content within the control's tags must correspond to the property specified in the second argument.

Table A-19. System.Web.UI.TemplateContainerAttribute

Summary

Informs the parser of the type of the container control of an ITemplate property. The parser uses this type as the exact type of the Container in data-binding expressions.

Applied to

Properties of type ITemplate

Sample usage

[TemplateContainer(typeof(ContactPanel)]

Example

The ContactInfo control in Listing 12-7



Developing Microsoft ASP. NET Server Controls and Components
Developing Microsoft ASP.NET Server Controls and Components (Pro-Developer)
ISBN: 0735615829
EAN: 2147483647
Year: 2005
Pages: 183

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net