Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GridView Conditional Formatting 1

Status
Not open for further replies.

Waynest

Programmer
Jun 22, 2000
321
GB
Hi

I have the following code in Page Load event to show overdue lines in a GridView with date in red...

for (int i = 0; i < GridView1.Rows.Count; i++)
{
if (Convert.ToDateTime(GridView1.Rows.Cells[7].Text)<= DateTime.Now)
{
GridView1.Rows.Cells[7].ForeColor = System.Drawing.Color.Red;
}
}


It works fine for the first display of the page, but the dates are not shown in red on subsequent displays (when item is edited etc) although the debugger shows the code is still executing as expected. Its not inside if !IsPostback.

What did I miss?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top