ASP.NET Web Server
Using Visual Studio
ASP.NET Image Effects
DB Design tips
Design Secure Apps
Build Secure Apps
1.2 Inline/Hardcoding Styles
The other styling technique you can use when developing a Website with ASP.NET is through a Visual Control’s Properties.
When styles are applied using the properties window of the ASP.NET Control, the style information is stored in the control’s markup. This type of Styling is called inline styling as styling details like the font, color, and border width are all defined in the code of the control. Inline styling method hardcode markup values and this is not recommended by many programmers.
Below is a code snippet of the GridView control showing hardcoded inline Styles added to it via the Properties Window.
Inline styling can be easy to apply, but as your website becomes larger and more complex, it might be a difficulty to maintain consistency throughout. For instance, if you decide to change Border Color used on the grid, you would need to open every individual page and find the Control and go to the Properties window and change the Border Color value. This is the reason why many programmers like to store Styles in a common place which can be accessed and applied to the whole web site (will be shown in Chapter that follow).
Table of Contents
Chapter 1 - Placing Style Rules