Q:

How to get all values in a certain GridView column?

I want to check if a deleted row has a value in a certain cell that's the last one of its kind in the whole GridView. I know that i can get the value of a cell of a deleted row by this :
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
   Response.Write(e.Values["img_cat"]);            
}

But don't know how to check that the value inside the img_cat column of the deleted row doesn't exist in any other img_cat cell.
Also, i want to know if this approach is better for checking for the existence of a certain cell value in a database. Or just doing the check in the database directly inside RowDeleted event. 

A:

As a supplement to @PranayRana's answer, you could also use Linq:
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
   var val = e.Values["img_cat"];
   if (!(sender as GridView).Cast<GridViewRow>().Any(x => x["img_cat"] == val))
   {
       //It's the last one, do something.
   }
}

