GridView Row Color

GridView Row Color :-

There is often required to changed display color of gridview.For Example some time it required’s that in Product detail we need to display Expired product row by red Color.It Can be possible in Gridview by RowDataCommand Event.
Here Example Shown in Which if Product is Active then LightGreen Color Shown Else Normally Color Display Which We Select in Gridview
if (e.Row.RowType == DataControlRowType.DataRow)
e.Row.BackColor = System.Drawing.Color.White;
// determine the value of the UnitsInStock field
LinkButton link_active = (LinkButton)e.Row.FindControl("link_active");
if (link_active.Text == "")
e.Row.BackColor = System.Drawing.Color.LightGreen;

Prev Post                                                      All Post                                                           Next Post

Posted in |


Post a Comment