I am unable to update table when the users clicks on the register button. My code is listed below.

vb:
Dim retstruct As RegisterCourseInfo
Dim uN As String


For Each row As GridViewRow In GridView1.Rows
Dim cb As CheckBox = CType(GridView1.FindControl("ChkSelect"), CheckBox)

If cb IsNot Nothing AndAlso cb.Checked Then

uN = GridView1.DataKeys(row.RowIndex).Value
retstruct = RegisterCourseIndividual(Request.QueryString("Cour seID"), Request.QueryString("SessionID"), uN, False)
cb.Checked = False

End If
Next


<asp:TemplateField InsertVisible="False">
<ItemTemplate>
<asp:CheckBox ID="ChkSelector" ViewStateMode="disabled" Checked="false" runat="server" />
</ItemTemplate>
</asp:TemplateField>

Would anyone have any ideas of why I am not getting the correct resluts?

Thank you in advance for looking.

For Each row As GridViewRow In GridView1.Rows
Dim cb As CheckBox = CType(GridView1.FindControl("ChkSelect"), CheckBox)

I believe you should be looking for the control inside the row, not the whole grid.
ie:

For Each row As GridViewRow In GridView1.Rows
Dim cb As CheckBox = CType(row.FindControl("ChkSelect"), CheckBox)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.