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

Alternating Rows

2 Answers 175 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 15 Nov 2010, 02:19 PM
Some skins (WebBlue, for example) have alternating colour rows enabled by default, others (including Office2007) don't.

Is it possible in a App_Theme's .skin file to enable alternating colours if the Skin setting for the RadGrid is one for which the alternating colours are usually disabled?

-- 
Stuart

2 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 15 Nov 2010, 02:27 PM
I really want to avoid having to create a custom skin for this.

--
Stuart
0
Dimo
Telerik team
answered on 15 Nov 2010, 03:45 PM
Hi Stuart,

Alternating row styles can be disabled if you set EnableAlternatingRows="false" in the RadGrid ClientSettings. This will prevent the rgAltRow CSS class from being rendered, and rgRow will be used for all rows. However, you can't "invent" alternating row styles for skins, which do not have them, as Office2007, Vista, etc. In this case you can override the skin and add background color styles for the rgAltRow CSS class, according to your preference.

http://blogs.telerik.com/dimodimov/posts/08-06-17/how_to_override_styles_in_a_radcontrol_for_asp_net_ajax_embedded_skin.aspx

Overriding a skin is simpler than creating a custom skin.

Note that after you add rgAltRow styles with higher specificity, you will override the background styles for hovered and selected rows and as a result, you will need to redefine these styles with higher specificity as well. Here something similar is done:

http://www.telerik.com/community/code-library/aspnet-ajax/grid/how-to-preserve-the-original-radgrid-selected-hover-row-background-when-using-itemstyle-backcolor.aspx

(you don't need !important in your case, as you will not be overriding inline styles)

Sincerely yours,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
Dimo
Telerik team
Share this question
or