0

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.

2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by |-|x
1
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)

Edited by |-|x: code type

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.