How to give a color to the Column Header in Telerik RadGrid

后端 未结 4 2091
一生所求
一生所求 2021-01-22 05:07

I have created a telerik RadGrid in asp .net. My requirement is to give my own color to Column header. How can we achieve this...? Below is the code structure I\'m using.

<
4条回答
  •  情深已故
    2021-01-22 05:27

    Telerik automatically uses a skin for its grid. If you have not specified a skin it will use the Grid.Default skin. You can modify this skin or any of the skins to your own custom style. Just follow these steps.

    • Change the properties in the css file. (The default grid skin is called Grid.Default.css. On my computer it is found in the folder where I have the telerik RadControls for ASP.NET AJAX in the folder Skins\Default.) In this case, change the css something like this:

    Grid.Default.css (line 59)

    .RadGrid_Default .rgHeader,
    .RadGrid_Default th.rgResizeCol
    {
      border:0;
      border-bottom:1px solid #828282;
      background-color: Red;
      /* background:#eaeaea 0 -2300px repeat-x url('Grid/sprite.gif'); */
    }
    
    • Add a link to the css file that you modified on the page where you have your grid (or in the master page).

    • Add the property EnableEmbeddedSkins="false" to your RadGrid. This will tell the page to use your modified css file instead of the embedded one.

    Telerik's web site has a blog post called How To Override Styles in a RadControl for ASP.NET AJAX' Embedded Skin that explains in detail how to override an existing style.

提交回复
热议问题