Getting the Value of a Checkbox in the GridView Selected Row

Discussion in 'ASP .Net Web Controls' started by Kirk, Mar 6, 2007.

  1. Kirk

    Kirk Guest

    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!
    Kirk, Mar 6, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Neil
    Replies:
    0
    Views:
    741
  2. Kirk
    Replies:
    2
    Views:
    1,702
  3. stavo23
    Replies:
    0
    Views:
    2,146
    stavo23
    Feb 26, 2008
  4. Want to add row under selected row of gridview

    , Feb 16, 2007, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    292
  5. Selected Row Only GridView Row Visible?

    , Oct 17, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    280
Loading...

Share This Page