Home > Code > C# > GridView row color change

GridView row color change

by Narain Siddharth   on Nov 13, 2010   Category: C#   |  Views: 2289    |  Points: 25   |  Silver 


write the below code in the RowEditing Event of GridView.

try
{
foreach (GridViewRow gridRow in GridviewControlName.Rows)
{
if (gridRow.RowType != DataControlRowType.Header && gridRow.RowType ! = DataControlRowType.Pager && gridRow.RowType != DataControlRowType.Footer)
gridRow.BackColor = System.Drawing.Color.White;
}
int index = e.NewEditIndex;
GridViewRow row = GridviewControlName.Rows[index];
row.BackColor = System.Drawing.Color.LightGoldenrodYellow;
}
catch (Exception ex)
{
}






Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts