how to put gridview selected row color conditionwise?
like
string x = e.Row.Cells[8].Text.ToString();
string y = e.Row.Cells[7].Text.Trim();
if (x> y)
{
//those row color are red;
}
else
{
//those row color are blue;
}
Gridview
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Vishwas Kadamannaya111 reputationPosted Aug 21, 2013, 11:20 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 21, 2013, 11:24 PM EDT
You can use GridViewRowDataBound for setting selected row color
in your aspx
in your code
string x = e.Row.Cells[8].Text.ToString();
string y = e.Row.Cells[7].Text.Trim();
e.Row.BackColor = System.Drawing.Color.Red;
}
else
{
e.Row.BackColor = System.Drawing.Color.Blue;
}
Regards,
Iftikar