C1GridView Setting Row Backcolor

Posted by: mcapogrosso on 10 September 2017, 11:35 am EST

  • Posted 10 September 2017, 11:35 am EST

    I am using the following code



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


     {


              if ((e.Row.RowIndex == 2)) { 


                              e.Row.BackColor = System.Drawing.Color.Red;


               }


    }



     


    However if I have set the VisualStyle property to Office2007Blue, the row does not change to red.  If I remove the VisualStyle, the row changes to red. 


    So if I have a VisualStyle, I cannot change the backcolor of a particular row?????????


    I am using version 3.5/20093.148




  • Replied 10 September 2017, 11:35 am EST

    >> However if I have set the VisualStyle property to Office2007Blue, the row does not change to red.


    >> If I remove the VisualStyle, the row changes to red.


    It means that inline style has lower priority than VisialStyle css applied to a row.


    >>So if I have a VisualStyle, I cannot change the backcolor of a particular row?????????


    Try the following:



    e.Row.CssClass = "redrow";


    Regards,


    Sergey.

Need extra support?

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

Learn More

Forum Channels