item backColor overriding hover color

5 posts, 0 answers
  1. Adam King
    Adam King avatar
    23 posts
    Member since:
    May 2010

    Posted 09 May 2013 Link to this post

    We changed our grid to assign an item Backcolor ( e.Item.BackColor = System.Drawing.Color.Red;) and now the hover color is gone. We do this on itemDataBound.

    Before this change, hovering over each row would change the background.
    We still have the client settings set: EnablePostBackOnRowClick="True" EnableRowHoverStyle="True"

    is there a way so the BackColor does not override the hover, we just want to see the hover color again, I believe it defaulted to light blue.

    Thanks
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 09 May 2013 Link to this post

    Hi,

    Please try adding a CssClass for the row and add a style on hovering as follows.

    C#:
    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            //your code
            e.Item.CssClass = "RowStyle";
        }

    CSS:
    <style type="text/css">
         .RowStyle:hover
         {
             background-color:#829CBF ! important;
         }  
            
        </style>

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam King
    Adam King avatar
    23 posts
    Member since:
    May 2010

    Posted 10 May 2013 Link to this post

    The CssClass is working but the hover is not.
    I have the hover-style code on the top of my page (there is a master page too) but it doesn't take effect.
    Is there another place to put this style? or set as a property in the grid code?
  5. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 13 May 2013 Link to this post

    Hi,

    Please try the following CSS.

    CSS:
    <style type="text/css">
        .rgHoveredRow
        {
            background-color: #829CBF !important;
        }
    </style>

    Thanks,
    Princy.
  6. Adam King
    Adam King avatar
    23 posts
    Member since:
    May 2010

    Posted 13 May 2013 Link to this post

    That one works.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017