If you want to reprint it, Please retain your copyright:
/*
* Description: ASP. NET custom server control internal details series tutorial
* Auther: chongchong-innocent haoban
* MSN: chongchong2008@msn.com
* Dates: 2007-05-20
* Copyright: chongchong2008 Yichang Hubei China
*/
4. server control-related metadata attribute
1. Design Phase attribute
Attribute during the design period is very important for the control to run correctly in the visual designer. The attribute browser and other design period elements use the metadata provided by the attribute during the design period. The functions are as follows:
Show properties and events
Execute serialization during design period
Associate classes used to implement functions during the design period with controls or attribute types.
1.1 display attributes and event attributes
System. componentmodel. bindableattribute
Description: Whether binding data to a property in the property browser is meaningful. Attributes marked with Bindable (true) can be displayed in the databinding dialog box loaded from the property browser.
Application: applies only to attributes.
System. componentmodel. browsableattribute
Description: whether the property browser displays properties or events in the property browser. The property browser displays all public properties and events by default.
Application: attributes and events
System. componentmodel. categoryattribute
Description: provides a category name to display attributes or events.
Application: attributes and events
System. componentmodel. defaulteventattribute
Description: informs the property browser which control event is the default event. Allows page developers to double-click the control in the design interface and write event processing for the default event.Code
Application: only apply events
System. componentmodel. defaultpropertyattribute
Description: informs the property browser which control property is the default property. This property is highlighted by the property browser when the page developer selects the control on the page.
Application: only apply attributes
System. componentmodel. descriptionattribute
Description: provides a brief description. This description is displayed in the property browser when a property or event is selected.
Application: attributes and events
System. componentmodel. editorbrowsableattribute
Description: shows the support for interllisense when the code editor is a property, method, or event.
Application: attributes, methods, and events
1.2 serialized attribute during design
System. componentmodel. defaultvalueattribute
Description: provides a default value for the property.
Application: attribute
System. componentmodel. designerserializationvisibilityattribute
Description: whether the designer serializes the content of an attribute or attribute. A complex attribute contains content, such as a subattribute or collection item. designerserializationvisibility, which has the following values:
Content-promotes the serialization of attribute content (such as sub-attributes or set items)
Hidden-hide attributes from serialization Mechanism
Visible-serialized property value
Application: attribute
System. componentmodel. policyparentpropertyattribute
Description: informs the property browser to upload a change notification from the Child property to the parent property or to the control.
Application: complex attributes and Their subattributes
System. Web. UI. persistchildrenattribute
Description: whether the content nested in the control label of the designer corresponds to the sub-controller or attribute. webcontrol is marked as persistchildren (false)
Application: Control
System. Web. UI. persistencemodeattribute
Description: whether the designer saves the attribute to the label of the control, or saves it as a nested attribute.
The persistencemode Enumeration type has the following values:
Attribute: saves the attribute as an attribute on the control label.
Encodeinnerdefaultproperty-Saves the property as the only content in the control label. The content is encoded HTML
Innerproperty-Saves the property as the only content in the control label.
Innerdefaultproperty-Saves attributes and any other properties of the control as nested content in the control label.
Application: attribute
System. Web. UI. tagprefixattribute
Description: informs the designer to generate a register command to map a label prefix to the namespace and accessories. when the page developer drag the control from the toolbox to the design interface, this command is in. generate An ASPX page
Application: accessories containing server controls
1.3 attribute of associated classes that provide features during the advanced design period
System. componentmodel. designerattribute
Description: Associate the designer with the control.
Application: Control
System. componentmodel. editorattribute
Description: associate a user interface type editor with a type or attribute, and associate a component editor with a control.
Application: class or attribute
System. componentmodel. typeconverterattribute
Description: associates a type converter with a type or attribute.
Application: class or attribute
2. Attribute during parsing
Used by the page parser to parse the. ASPX page syntax and generate code for the classes on the corresponding page
System. Web. UI. controlbuilderattribute
Description: associate a control with a custom control generator.
Application: class or attribute
system. Web. UI. parsechildrenattribute
Description: whether the notification parser translates the nested content in the control label into attributes or child controls.
the control does not mark this attribute, meaning that the parser treats the nested content as a child control.
webcontrol is marked as parsechildren (true), so the parser regards the nested content as an attribute.
the second parameter in the two parameter form of this attribute is the attribute name, when two parameters are used, the nested content in the control label must be consistent with the attribute set by the second parameter
application: Control
System. Web. UI. templatecontainerattribute
Description: Type notification Parser for the container control of the itemplate attribute. The parser uses this type as the exact type of the container in the data binding expression.
Application: attributes of the itemplate