How to apply a CSS class to all instances of a control in ASP.NET


Problem :

I am trying to implement the jQuery UI framework for my ASP.NET project. And the way I thought of going about doing this is to just apply CSS to my controls.

For example, I have a bunch of GridView controls. Is there an easy way to apply a CSS class to all of them at once instead of using the "onRender" event on each instance like I have read online?

Solution :

You can create a .skin file that specifies the CssClass to apply to each GridView. See ASP.NET Themes and Skins in MSDN Library for more information.

// In your App_Themes/SomeTheme/ file:
<asp:GridView runat="server" CssClass="YourCssClass" />

// In Web.config:
<pages styleSheetTheme="SomeTheme" />

    CSS Howto..

    Meeting Calendar | How to take care of the overlapping meetings to show in the calendar?

    How to create popups in css /Javascript?

    How to use jQuery to fade in/out li a:hover css background-color?

    How does this drop-down have the ^ shown?

    div content shows when display:none

    How can I force LESS (css) to recognize a variable?

    Boostrap: How to “stick” a button over an image when re-sizing

    Markup/Style best practices: How to efficiently distribute style rules over CSS classes?

    How can I rotate a font icon 45 degrees?

    bootstrap css how to resolve conflict

    How to override a templates default option with javascript and css

    How to transform an image in SVG (or CSS) into a non-parallelogram shape?

    How do I get one element to respond to the click of another element? - CSS/jQuery

    How to debug the different behavior of the same browser on the different platforms?

    How to provide CSS properties for Different browsers like Mozilla and Chrome

    CSS Syntax - How to interpret this?

    How to create a vertical line with a text in the middle

    How do I prevent the element of an HTML5 form from moving slightly?

    Why do the Google Fonts fail to show up on my website?

    How can I add CSS animation to an element on a web page? [closed]

    How to expand link on hoover? Add “<” “>” symbols around link?

    How do I vertically centre a div of variable height within a div of variable height?

    How to add CSS stylesheet to aspx.vb table

    How to Change CSS style of the same element that is NOT Hovered

    How do I set a cell background colour based on its contents using PHP after reading values from MySQL?

    How do I fix a Wordpress meta box that's blown out by it's content?

    How to create a margin between two seperate divs?

    How to make text slide by only using css/html

    How to add rows to a responsive grid

    How do I design a css gradient to look like the attached Facebook Login screen