asp.net.ph

Skip Navigation Links

Style Properties

ASP.NET Syntax   ASP.NET Syntax for Web Controls


Some controls support style properties 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, set the properties for the appropriate style object.

<asp:control id="accessID"  runat="server">

   <StyleObject property1Name = "value"
      property2Name = "value" ... />

</asp:control>

Remarks

All style classes derive from the Style class and support the properties defined in the base class. Style classes also implement additional properties specific to the class.

When declaring a Web server control, specify the properties for a particular style object by nesting the element that represents the object ( such as <SelectedDayStyle> ) between the opening and closing tags of the parent control. You can then list the individual style properties ( such as BackColor = "Blue" ) within the element.

For detailed information about these properties, see the Style Class, TableItemStyle Class, and DataGridPagerStyle Class.

Syntax Example

To set the appearance of the selected day in a Calendar Web server control, set the style properties of the SelectedDayStyle style object. To give the selected day a blue background and red text with Arial font, use the following syntax ( notice that the Font property belongs to the control and not the SelectedDayStyle style object ) :

<asp:Calendar id="myCalendar"
   Font-Name = "Arial"
   runat="server">

   <SelectedDayStyle BackColor = "Blue"
      ForeColor = "Red" />

</asp:Calendar>
See Also

Style Class



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note