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

Selected Item Color

4 Answers 130 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 2
Markus asked on 13 Aug 2008, 01:12 PM
Hello!

I have a RadGrid with the Skin "Office2007" and AllowRowSelect="true"

When a user clicks on an item the color changes to orange.
I tried to set the SelectedItemStyle-BackColor of the Radgrid but the
orange stays.

The behavior i would like to achieve is that the selected items do not differ from the ones not selected.


Thx for solutions.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Aug 2008, 08:16 AM
Hi Markus,

You can try with the following approach.

ASPX:
<head runat="server"
    <title>Untitled Page</title> 
     
    <style type="text/css" > 
 
      .RadGrid_Office2007 .MySelectedClass  
       {  
         background:none  ;  
        }  
 
    </style> 
</head> 


 <telerik:RadGrid ID="RadGrid1" runat="server"     AllowMultiRowSelection="True" DataSourceID="SqlDataSource1" GridLines="None" Skin="Office2007" > 
            <SelectedItemStyle CssClass="MySelectedClass"    /> 


Hope this helps..
Shinu.
0
Dimo
Telerik team
answered on 14 Aug 2008, 12:40 PM
Hello,

In addition to what Shinu suggested, one also has to revert the border color of selected items to the default color. For example, if we use the same custom CSS class MySelectedClass :


.RadGrid_Office2007  .MySelectedClass  td
{
    border-color: #d0d7e5 ;
}


Regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Markus
Top achievements
Rank 2
answered on 18 Aug 2008, 06:26 AM
Thank you for the solution.

It works fine for items that are in view mode. In my case i set all items of the grid to edit mode and then the background is yellow. When clicking on an edit item it becomes white and the borders appear.

What css properties do i have to set in order to influence the color of Selected Edit Items??

Thx in advance
0
Dimo
Telerik team
answered on 18 Aug 2008, 01:33 PM
Hi Markus,

Selected items in edit mode have two CSS classes applied at the same time:

.SelectedRow_Skin
.GridEditRow_Skin


The appearance of selected edit items will depend on the order and specificity (weight) of the CSS rules, used separately for styling selected and edit items. For example if you have:

.RadGrid_Office2007  .SelectedRow_Office2007  td
{
    border-color: #d0d7e5 ;
}


The specificity of the CSS selector is 21 points (2 CSS classes x 10 points and one HTML element x 1 point).

In order to modify the appearance of selected edit items, you will need to use:


.RadGrid_Office2007  tr.GridEditRow_Office2007  td
{
    border-color: red ;
}



The specificity here is 22, so the rule will override the previous one at all times. However, if the two rules have the same specificity, the one which comes second, will be applied.


Let us know if you need further advice.


Regards,
Dimo
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Markus
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Dimo
Telerik team
Markus
Top achievements
Rank 2
Share this question
or