Getting the Value of a Checkbox in the GridView Selected Row

K

Kirk

I have a GridView that displays several columns, one of which is a
checkbox field. This is populated at runtime from a SqlDataSource and
is not enabled (the user can't change it's value). I have turned on
the "Enable Selection" option, and I know I can identify what is the
currently selected row.

How can I get the value [True/False] of the checkbox in the selected
row? For columns that are just text, this works:

System.Diagnostics.Trace.WriteLine(Me.GridView1.SelectedRow.Cells(3).Text)

...but it does not work on a column that is a checkbox (returns nothing
since there is no text in that column). I have tried to use the Ctype
method to cast the column as a checkbox, but I can't get that to work
either.

I realize that I am missing something stupid, and I would appreciate a
tip or suggestion.
Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top