-1

Attempting to use the code below to no avail - I cannot seem to locate the checkbox control. Note: the grid does return the expected number of rows. As indicated in the title I am trying to find the checkbox from another user control on the same parent page.

    Dim grid As GridView = CType(Me.Parent.FindControl(SearchControlID).FindControl("grdSearchResults"), GridView)

    For Each row As GridViewRow In grid.Rows
        Dim selectedRow As CheckBox = row.FindControl("chkRequestReference")
        If (selectedRow.Checked) Then
            rowSelected = True
            Exit For
        End If
    Next
David
  • 58
  • 1
  • 6

1 Answers1

0

A GridView is not a control container. It is a set of rows and columns. When you configure it you can set specific columns as CheckBoxes and you can make a direct reference to that column. For example:

grid.Rows(RowNumber).Columns(ColumnName or ColumnIndex).Value

  • Nothing = Undefined
  • 0 or False = Unchecked
  • Anything else = Checked
Henrique
  • 66
  • 2