Some controls support style objects that allow you to set the appearance, such as color and font, of individual elements within the control. To change the appearance of an element, you set properties of the appropriate style object.
For example, to set the appearance of the selected day in a Calendar Web control, you set style properties of the SelectedDayStyle style object. To give the selected day a blue background and bold red text in the Arial font, you would use the following syntax:
<asp:Calendar id="Calendar1" runat="server" SelectedDayStyle-BackColor="Blue" SelectedDayStyle-ForeColor="Red" SelectedDayStyle-Font-Bold="True" SelectedDayStyle-Font-Name="Arial"> </asp:Calendar>
<asp:control id=value runat="SERVER" StyleObject-property="value" > </asp:control>
All style objects support the base properties defined in the base Style class. Other style classes derive from the Style class and support additional, class-specific properties.
Style class | ASP+ syntax | Data type |
---|---|---|
Style
(Base style properties) |
styleobject-BackColor | Color |
styleobject-BorderColor | Color | |
styleobject-BorderStyle | BorderStyle (Dashed, Dotted, Double, Groove, Inset, None, NotSet, Outset, Ridge, Solid) | |
styleobject-BorderWidth | Unit | |
styleobject-CssClass | String | |
styleobject-Font-Bold | Boolean | |
styleobject-Font-Italic | Boolean | |
styleobject-Font-Name | String | |
styleobject-Font-Names
When programming, this property is a collection of strings. |
String | |
styleobject-Font-Overline | Boolean | |
styleobject-Font-Size | FontUnit | |
styleobject-Font-Strikeout | Boolean | |
styleobject-Font-Underline | Boolean | |
styleobject-ForeColor | Color | |
styleobject-Height | Unit | |
styleobject-Width | Unit | |
styleobject.IsEmpty
(Programming only) |
Boolean | |
TableItemStyle | styleobject-HorizontalAlign | HorizontalAlign (Center, Justify, Left, NotSet, Right) |
styleobject-VerticalAlign | VerticalAlign (Bottom, Middle, NotSet, Top) | |
styleobject-Wrap | Boolean | |
DataGridPagerStyle | PagerStyle-Mode | PagerMode (NextPrev, NumericPages) |
PagerStyle-NextPageText | String | |
PagerStyle-PageButtonCount | Integer | |
PagerStyle-Position | PagerPosition (Bottom, Top, TopAndBottom) | |
PagerStyle-PrevPageText | String | |
PagerStyle-Visible | Boolean |
See Also