This is a migrated thread and some comments may be shown as answers.

Matching a template column's control backcolor with the active Item backcolor.

1 Answer 39 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 28 Mar 2011, 08:08 PM
Ok  here goes... I have a RadGrid on my page.  When the Grid gets rendered each item has alternating backcolors.  So the items backcolor is gray, white, gray, white... and so forth.  This is set by the skin.  I did not configure anything specifically regarding the alternating item style.

Now the grid also contains a template column that contains a RadListBox control.  I wrote code that puts listitems in that ListBox.  Here's the problem though... the backcolor of the ListBox is white.  So whether the griditem's backcolor is white or gray, the listbox backcolor is still white.  No problem on the white griditems, but on a gray griditems, its doesnt look good.  I want the backcolor of the Listbox to be the same as the backcolor for the particular griditem its in.  So if the griditem's backcolor is gray, then I want the ListBox to have a gray backcolor.  If the griditem's backcolor is white, then I want the ListBox to stay with a white backcolor.  I am trying to get a look where the user doesn't see a Listbox, but thinks its just part of the data on that griditem.

Any suggestions.
DB

1 Answer, 1 is accepted

Sort by
0
Galin
Telerik team
answered on 31 Mar 2011, 02:36 PM
Hi Dan,

This can be achieved by adding CSS rule that point all listBox elements in alternating row and set the background-color. You can see styles of any element by inspecting it with Firebug for Firefox / IE Developer Tool.

For instance your css have to be like this (example for RadGrid Default Skin) :
.RadGrid_Default .rgAltRow .RadListBox,
.RadGrid_Default .rgAltRow .RadListBox .rlbList
{
     background-color: grey;
}

Additionally, I recommend that you read more about CSS Rules and CSS Specificity.

Kind regards,
Galin
the Telerik team
Tags
Grid
Asked by
Dan
Top achievements
Rank 1
Answers by
Galin
Telerik team
Share this question
or