Have you debug your code and check what the value is coming in
dr1[0]
, you got the error from there.
and also your query
string query = "update Product_Details set [GatePass status]='Close' where ID in ('"+Session["ID"]+"')";
I think you need to update data with using IN cause, so you need to convert your list of id to coma separated string for applying it in
WHERE ID IN ('....')
cause.
and modified query looks like this..
string query = "update Product_Details set [GatePass status]='Close' where ID in ("+ string.Join(",", (List<int>)Session["ID"]) +")";</int>