Basically I can't get the value from cells, the column contains only integers and using Convert gives exceptions so is adding fila.Cells[4].Value, been trying some solutiosn I've found online (commented in the code), but still.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
foreach (GridViewRow fila in Tabla.Rows)
{
//int celda = Convert.ToInt32(Tabla.Rows[4].ToString()); //ArgumentOutOfRangeException
//var celda = Convert.ToInt32(fila.Cells[4].ToString()); //FormatException
//var celda = Convert.ToInt32(fila.Cells[4]); //InvalidCastException
if (celda > 10)
{
//Visual Alert on cell
}
}
}
Inside the if statement, it should display an alert (out of stock, low stock, etc)
Is it even possible to do that or I'm just wasting my time?
For the RowDataBound event you really want to use the event GridViewRowEventArgs to get the current row. You can do something like this.