I have a simple table that gets its data from one Orders table by SqlDataSource. When rendering the page at the first time I save the latest order (by the highest ID).
Every 5 minutes I am auto-refreshing the page and getting from Session the latest order in the previous page loading.
Than I am looking for new order in the new rendered grid and marking the new orders in green bg color.
When searching in the grid cells, all the rows Text property is empty although the rendered grid data is OK.
What am I doing wrong?
The code:
gridOrders.DataSource = sdsOrdersTable;
DataBind();
if (Session["LatestOrderID"] == null)
{
//Save
//Get the highest order
Session["LatestOrderID"] = intLatestOrderID;
}
else
{
//Marking new orders
intLatestOrderID = (int)Session["LatestOrderID"];
foreach (GridViewRow row in gridOrders.Rows)
{
//The problem: row.Cells[0].Text == ""
if (int.Parse(row.Cells[0].Text) > intLatestOrderID)
{
row.BackColor = Color.Green;
}
}
}