Alternating Rows

3 posts, 0 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 15 Nov 2010 Link to this post

    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. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 15 Nov 2010 Link to this post

    I really want to avoid having to create a custom skin for this.

    --
    Stuart
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 15 Nov 2010 Link to this post

    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
Back to Top