Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
589
How to change the Row backcolor at the run-time.
posted

HI,

The WebDataGrid (12.2.20122.2054) grid is loading the data from a data table and want specific rows to be highlighted in different back color.

The below code snipped is used to change the row's css class.

For intRow = 0 To UGData.Rows.Count - 1
objGridRecord = UGData.Rows(intRow)
If Trim(objGridRecord.Items(1).Text) = "sectionheader" Then
objGridRecord.CssClass = "ig_Item_Selected_about"
End If
Next intRow

The CSS Class is below

.ig_Item_Selected_about
{
font-size:13px;
font-family: verdana;
padding-left:1px;
font-weight: bold;
background-color:#b0eac0;
}

The row's font is bold, but backcolor  didn't change. Any ideas?

Regards, Karthik

  • 29417
    Verified Answer
    Offline posted

    Hello Karthik,

     

    Thank  you for posting in our forum.

     

    The background-color needs to be applied to the cell elements so if you set the class like this:

    .ig_Item_Selected_about  >  td

    {

    background-color:#b0eac0 !important;

    }

     

    It should set the background color for the cells in the corresponding rows. And since it has the !important tag on it , it will overwrite the default settings that may come from the grid theme you've chosen.

     

    For more styling tips in the WebDataGrid you can refer to the grid’s styling guide:

    http://es.infragistics.com/community/blogs/engineering/archive/2010/08/25/webdatagrid-css-styling-guide.aspx

     

    Let me know if you have any questions or concerns.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer II

    Infragistics, Inc.

    http://es.infragistics.com/support