checkboxes nested in a gridview

Discussion in 'Microsoft ASP .NET' started by abbas24, Jul 9, 2012.

  1. abbas24

    abbas24 Guest

    I have a gridview with datakeyname = "module_id" and there are checkboxes in the itemtemplate...

    Now on the click of a button I want to check which checkboxes are checked and which are not checked....

    below is my code....

    Dim module_string As String
    For Each gvrows As GridViewRow In gvw_modules.Rows
    Dim cb As CheckBox = DirectCast(gvrows.FindControl("chk_module"), CheckBox)
    If cb IsNot Nothing Then
    If cb.Checked Then
    module_string = module_string & "," & gvw_modules.DataKeys(gvrows.RowIndex).Value
    End If
    End If
    Next

    But it just gives value as 1, Rowindex is increasing properly but Value remains 1 only...I dont understand where am I going wrong....
     
    abbas24, Jul 9, 2012
    #1
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
  1. Guest

    nested Repeaters with javascript checkboxes

    Guest, Apr 16, 2004, in forum: Microsoft ASP .NET
    Replies:
    0
    Views:
    892
    Guest
    Apr 16, 2004
  2. Replies:
    0
    Views:
    1,227
  3. H5N1
    Replies:
    0
    Views:
    432
  4. Guest

    GridView Hierarchical View - Gridview in Gridview

    Guest, May 9, 2006, in forum: Microsoft ASP .NET
    Replies:
    1
    Views:
    1,150
    Guest
    May 9, 2006
  5. Samy
    Replies:
    0
    Views:
    262
  6. H5N1
    Replies:
    0
    Views:
    1,788
  7. joebob8000
    Replies:
    0
    Views:
    1,422
    joebob8000
    Dec 4, 2006
  8. Enabled checkboxes in gridview control

    , Dec 23, 2006, in forum: Microsoft ASP .NET
    Replies:
    2
    Views:
    209
Loading...