GridView CSS overriding RowDataBound?

Posted by: tlbradshaw on 10 September 2017, 11:32 am EST

  • Posted 10 September 2017, 11:32 am EST

    I have a piece of code that inspects each row during the
    "RowDataBound" event.  If the row matches my criteria it is supposed to
    change the background and font to colors of my choice.


    This worked fine using a C1WebGrid control, and seems to only work on
    the C1GridView control if I remove the formatting for the row in the
    CSS.  It seems as though the CSS is overriding my formatting.  Is there
    any way to stop this?


    I have the ".C1GridView .C1Row .C1Gtd AND.C1GridView .C1AlternatingItems .C1Gtd" background-colors
    set in the CSS.

  • Replied 10 September 2017, 11:32 am EST

    Hi,


    The following code illustrates an idea how you can do that (assuming that "ArcticFox" VisualStyle is used)


       


       void C1GridView_RowDataBound(object sender, C1.Web.UI.Controls.C1GridView.C1GridViewRowEventArgs e)


       {


           if (condition)


           {


              e.Row.CssClass = "MyRowCss";


           }


       }


    Regards,


    Sergey.

  • Replied 10 September 2017, 11:32 am EST

    That seems to work perfectly.  Can I over ride the .C1HoverRow in the same way?  For example by adding


    .C1GridView_ArcticFox .MyRowCss .C1HoverRow .C1Gtd


    {


    background-color: #77933C;


    }

  • Replied 10 September 2017, 11:32 am EST

    Yes. Remove the space character between .MyRowCss and .C1HoverRow

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels