How to apply a CSS class to all instances of a control in ASP.NET
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?
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/Default.skin file: <asp:GridView runat="server" CssClass="YourCssClass" /> // In Web.config: <pages styleSheetTheme="SomeTheme" />