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

How to Change Grid Selection Back Color

3 Answers 310 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Syed
Top achievements
Rank 1
Syed asked on 17 Dec 2013, 12:05 AM
Hi,
Iam using Keyboard Navigation in my grid.Iam using Office2007 Skin for my grid and i have created my grid at runtime.

Now when i use keyboard navigation using  up down arrow key.The gird selection is moving to next cell but the back color is in Light blue .I want to change the selection back color to some other dark color.
Kindly refer the attached image.

I have tried all this styles to change the back color but northing works

.RadGrid_Office2007 .SelectedItem
 {
  background-image: url(img/SelectedRow.gif);
  background-repeat: no-repeat;
  background-position: top right;
    background-color: Green !important; 
     background: Green 0 -3900px repeat-x url('Grid/sprite.gif') !important;
 }
  .RadGrid_Office2007  .rgSelectedRow  
    {  
        background: Green 0 -3900px repeat-x url('Grid/sprite.gif') !important; 
    color:#fff; 
    }  
 .RadGrid_Office2007 .SelectedStyle
 

    background-color: Green !important; 

<%--.RadGrid td.rgSelectedCell
{
    background: #141414 !important;
     background-image: none;
}

.RadGrid .rgSelectedRow td
 {
   background-color: #141414 !important;
    background-image: none;
 }
 .RadGrid_Default th.rgHeader
 {
   background-image: none;
   background-color: Blue !important;
 } 

  .SelectedItem
    {
      background-color: Green !important;
    }

 .RadGrid .GridRowSelector_Default
    {
         background-image: none;
 
        background-color: Green !important;
    }
    .RadGrid .ActiveRow_Default td
    {
        background-image: none;
 
        background-color: Green !important;
    }
--%>



In Code behind i create grid like this
 grid.AutoGenerateColumns = false; // set the auto genrated columns as false
        grid.Skin = "Office2007";// set the Skin
        grid.AllowMultiRowSelection = true;//set the multirow selection as true or false     
 grid.ClientSettings.Selecting.CellSelectionMode = GridCellSelectionMode.MultiCell;
        grid.ClientSettings.Selecting.EnableDragToSelectRows = false;
        grid.ClientSettings.AllowKeyboardNavigation = true;
        grid.ClientSettings.KeyboardNavigationSettings.EnableKeyboardShortcuts = true;
        grid.ClientSettings.KeyboardNavigationSettings.AllowActiveRowCycle = true;

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Dec 2013, 03:51 AM
Hi Syed,

Please try the following CSS to have the selected row color:

CSS:
<style type="text/css">
    .RadGrid_Office2007 .rgSelectedRow td
    {
        background-color: Blue !important;
        border-bottom-color: Blue !important;
    }
</style>

Thanks,
Princy
0
Syed
Top achievements
Rank 1
answered on 17 Dec 2013, 04:03 AM
Hi,
Thanks but this doesnt work
0
Princy
Top achievements
Rank 2
answered on 18 Dec 2013, 05:10 AM
Hi Syed,

Make sure that you  have not styles anywhere that affects the selected row. I wasn't able to replicate the issue, Please try the following CSS as well and see if it makes any difference.

CSS:
<style type="text/css">
       .rgSelectedRow
       {
           background: red !important;
           color: black !important;
       }
       .rgSelectedRow td
       {
           border: red !important;
       }
       .rgSelectedRow a
       {
           color: black !important;
       }
   </style>

Thanks,
Princy
Tags
Grid
Asked by
Syed
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Syed
Top achievements
Rank 1
Share this question
or