The terms property and attribute are generally translated into "attributes". For example, the attribute of a category is a property in English, while the element attribute of HTML/XML is attribute in English. In. in net, the meaning and usage of property and attribute are different. However, Microsoft's online file also translates it into "attribute", which may be confusing and misunderstood; the method I like most is that property is an attribute, and attribute maintains the original text. In. net, different attributes can be applied to categories or attributes to make them have different features. This article will introduce some attributes that are commonly used in server controls.
I,DescriptionattributeCategory
Purpose: Specify the description of the control or attribute.
When descriptionattribute is applied to the control category, the set description is displayed in the control prompt in the toolbox.
<Description ("")> _
Public ClassTbbutton
InheritsSystem. Web. UI. webcontrols. Button
End Class
When descriptionattribute is applied to the properties of the control, a set attribute description is displayed in the Properties window.
<Description ("Alarm information")> _
Public PropertyConfirmmessage ()AsString
II,DefaultvalueattributeCategory
Purpose: Specify the default value of the attribute.
Use defaultvalueattribute to set the default attribute value. If the set attribute value is the same as the default value, this attribute value will not appear in Aspx.ProgramCodeMedium; I strongly recommend that defaultvalueattribute be applied to attributes, so the program code in aspx will be relatively small. Another important point is that if the default attribute value needs to be modified due to some factors, the property values of all controls on the developed pages are changed together. Because the original property values are default values and are not written into the aspx program code, the default values of controls are changed, attribute values of the control that has been configured on the page are fully applicable.
PrivateFconfirmmessageAs String=String. Empty
<Defaultvalue ("")> _
Public PropertyConfirmmessage ()As String
Get
ReturnFconfirmmessage
End Get
Set(ByvalValueAs String)
Fconfirmmessage = Value
End Set
EndProperty
III,CategoryattributeCategory
Purpose: Specify the attribute or event category name. When the attribute window is set to [category] mode, the attribute or event is displayed as a group.
For example, if the confirmmessage attribute is set to the "behavior" category, the confirmmessage attribute is classified as the "behavior" category.
<Category ("Behavior")> _
Public PropertyConfirmmessage ()AsString
IV,BindableattributeCategory
Purpose: specify whether a member is usually used for binding.
In the data close setting window, specify whether the property defaults to appear in the property list.
<Bindable (True)> _
Public PropertyConfirmmessage ()AsString
V,BrowsableattributeCategory
Purpose: specify whether the attribute or event should be displayed in the [attribute] window.
If the attribute does not need to be corrected during the design phase, you can set it not to appear in the attribute window. In this case, you can apply browsable (false) to the attribute.
<Browsable (False)> _
Public PropertyConfirmmessage ()AsString
Note: This article is also published in "the first it ". If you think this Article is helpful to you, remember to add popularity ^
http://ithelp.ithome.com.tw/question/10012016