Using below code We can set the background color of row based on the value in Gridview rowitem.
protected void gvMsg_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// determine the value of the UnitsInStock field
string Category =Convert.ToString(DataBinder.Eval(e.Row.DataItem,"ColumnName"));
if (Category.ToString() == "Value")
// color the background of the row yellow
e.Row.BackColor = Color.FromName("#8FB3E3");
}
protected void gvMsg_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// determine the value of the UnitsInStock field
string Category =Convert.ToString(DataBinder.Eval(e.Row.DataItem,"ColumnName"));
if (Category.ToString() == "Value")
// color the background of the row yellow
e.Row.BackColor = Color.FromName("#8FB3E3");
}
2 comments:
very nice materiel
change GridView row colors
Post a Comment