I am using the OnRowDataBound()
event to change the Row.BackColor
based on the text. Now my issue is, this is extremely slow. I have roughly 100 rows in the ASP:Gridview
and only need to evaluate the first row or index[0]. What optimization techniques do you guru's have on how to speed this process up?
protected void GridView1_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TableCell cell = e.Row.Cells[1];
string question = cell.Text;
if (question == "View below to get data:" | question == "Check the state information below:" | question == "Check the state information below:")
{
e.Row.BackColor = System.Drawing.Color.Gray;
}
}
}