ASP.NET Tutorial

.NET Framework

ASP.NET Introduction

ASP.NET Web Forms

Standard Controls

Label Control

TextBox Control

Image Control

Button Controls

Redirecting User

Using HyperLinks

RadioButton Control


CheckBox Control

CheckBoxList Control


ListBox Control

ImageMap Control

Event-Driven Programming

ASP.NET Page Structure


Master Page

View State

Visibility of Controls

Formatting Controls

Applying CSS

Dynamic CSS

Using Style Class

Themes and Skins

Panel Control

PlaceHolder Control

AdRotator Control

Calendar Control

File Upload, Virtual Path

Validation Controls

Page Navigation

User Control

Separating Code-Presentation

Overview of ADO.NET

Data Binding

DataBinding List Control

Using Style Class in ASP.NET

The style sheets are actually applied on the client-side. (This is the reason style sheets become ineffective on browsers that do not support JavaScript.)
You can also apply style-sheets on the server-side. ASP.NET provides the Style class (in the System.Drawing namespace) for this purpose. You can create an instance of this class, set its properties, and apply the instance to multiple controls at a time.


The Style class properties are applied to the Label and TextBox controls through the methods, ApplyStyle and MergeStyle. The difference between the two methods is that ApplyStyle overrides the existing properties of the control while MergeStyle does not. Hence, the back color of the Label control changes to blue, while it remains red for the TextBox control.