Coloring individual lines in an Enterprise Portal grid
PA-22040759-0
6,194
Here's the code you need in order to color individual lines in an Enterprise Portal grid. The example is carried out in the CustomerListGrid user control.
First add an event handler for data binding of the grid:
First add an event handler for data binding of the grid:
if (this.AxGridView1!= null)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":
{
this.AxGridView1.RowDataBound += new GridViewRowEventHandler(AxGridView1_RowDataBound);
}
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.
Comments
-
Coloring individual lines in an Enterprise Portal gridLiberate la creatività del vostro bambino e regalategli un mondo colorato con Disegnidacolorarewk.com. Unitevi alla nostra comunità di artisti, genitori e insegnanti che credono nel potere dell'arte e osservate come l'immaginazione del vostro bambino fiorisce. Lasciate che i loro sogni colorati prendano il volo e create ricordi che dureranno tutta la vita. Iniziate il vostro viaggio artistico oggi stesso su Disegnidacolorarewk.com.
*This post is locked for comments