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

Sitefinity Skin + RowSelect

1 Answer 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ChrisC.
Top achievements
Rank 2
ChrisC. asked on 09 Sep 2011, 11:52 PM
I have an interesting issue.  When I use the Sitefinity skin on RadGrid the row colors do not change when selected if I'm setting the row backcolor in the ItemCreated Event or setting the ItemStyle/AlternatingItemStyle in the ASP.

                <MasterTableView DataKeyNames="pID" CanRetrieveAllData="false">
                    <ItemStyle BackColor="White" ForeColor="Black" />
                    <AlternatingItemStyle BackColor="White" ForeColor="Black" />


OR

                    e.Item.ForeColor = Drawing.Color.Red
                    e.Item.Font.Bold = True


I need to be able to dynamically change row color based on values in the row, which is why I am handling the ItemCreated event, and I do not like having AlternatingItem's in the grid, which is why I'm setting the color in the ASP.  I really like the style of the Sitefinity skin, but if I cannot see which rows are selected, it's just not going to work.

I should also say, I've tried using the visual style builder to change the Sitefinity skin but nothing changed.  Selected rows still did not display as selected.

Any ideas?

1 Answer, 1 is accepted

Sort by
0
Galin
Telerik team
answered on 15 Sep 2011, 03:16 PM
Hello Chrisc.,

I strongly recommend that you avoid setting the background and other styles with markup attributes when it is possible to do it with CSS. This approach is obsolete and will have negative effect on the performance.

You can change the select or hover background for the Sitefinity Skin with this CSS:

div.RadGrid_Sitefinity .rgRow { /* change the background colour of rows */
    background: white;
}
 
div.RadGrid_Sitefinity .rgAltRow { /* change the  background colour for Alternated  rows */
    background: grey;
}
 
div.RadGrid_Sitefinity .rgSelectedRow {  /* change the background colour for alternated  rows */
 
    background: LightBlue;
}
 
div.RadGrid_Office2007 .rgHoveredRow { /* change the background colour for hovered rows */
    background: green;
}

For other Skins, replace _Office2007 with their _Name, read here more examples.

For further understanding of the matter, please read HTML rendering of RadGrid and a CodeLibrary about selected hover row background.

I hope this helps.


Best wishes,
Galin
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Tags
Grid
Asked by
ChrisC.
Top achievements
Rank 2
Answers by
Galin
Telerik team
Share this question
or