First add an event handler for data binding of the grid:
if (this.AxGridView1!= null) { this.AxGridView1.RowDataBound += new GridViewRowEventHandler(AxGridView1_RowDataBound); }Next add the code controlling the logic of the coloring. In this case lines are colored "beige", if the currency of the customer is "USD":
void AxGridView1_RowDataBound(object sender, GridViewRowEventArgs e) { Microsoft.Dynamics.Framework.Data.Ax.DataSetViewRow dataRow = null; string currencyCode; if (e.Row != null && e.Row.RowType == DataControlRowType.DataRow) { dataRow = (Microsoft.Dynamics.Framework.Data.Ax.DataSetViewRow)e.Row.DataItem; currencyCode = (string)dataRow.GetFieldValue("Currency"); if (currencyCode == "USD") { e.Row.BackColor = System.Drawing.Color.Beige; } } }
I my personal opinion colored rows are disturbing to the eye, and I would prefer to add an icon to the lines which should have special attention. You can see how to do that on the ActivityListGrid user control.