Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Trying to read a gridview value in a for each row event

$
0
0

I have an SQL database table with an datatype bit for the Active field.  I populate a gridview with the results of a stored procedure and am trying to hide the row where the Active (data type bit) = 0, the field name is Active.  Anyhow I have the following.

Foreach (gridViewRow gvr in gvw.Rows)       //gvw is the gridview control

{

Boolean btemp = Convert.ToBoolean(gvr.Cells[11].Text);//11 is the column that contains the Active data (bit data type).

//code here to hide row if btemp = 0//

}

this creates a runtime conversion error, string not recognized as a valid boolean.

any ideas?


Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>