Hi, I have a gridview with checkboxes in the 3rd column. I am trying to work out when they are selected. I have the following code:
foreach (GridViewRowInfo dr in gvMovies.Rows) if (dr.Cells[2].Value = true) MessageBox.Show("Row " + dr.Index + " selected");
|
I get the following error: Cannot implicitly convert type 'object' to 'bool'. An explicit conversion exists (are you missing a cast?) I have tried the following but nothing has worked:
foreach (GridViewRowInfo dr in gvMovies.Rows) if ((bool)dr.Cells[2].Value = true) MessageBox.Show("Row " + dr.Index + " selected");
|
foreach (GridViewRowInfo dr in gvMovies.Rows) if (Convert.ToBoolean(dr.Cells[2].Value) = true) MessageBox.Show(dr.Cells[2].Value + " Rows " + dr.Index + " selected");
|
Thanks for any replies
Jay