I have asp.net Gridview with a checkbox. If the user checks that record and clicks on submit button it should approve that record.
Problem is if I have 10 records in the grid and I selected one item it is giving me errors. How can I fix it??
I tried below ways
<asp:TemplateField HeaderText="Approve" ItemStyle-HorizontalAlign="center">
<ItemTemplate >
<asp:CheckBox ID="chkApprove" runat="server" />
</ItemTemplate>
</asp:TemplateField>
Try 1:
Dim rowcount As Integer = grv_orders.Rows.Count
For iRow As Integer = 0 To rowcount - 1
Dim row As GridViewRow = grv_orders.Rows(iRow)
Dim cb As CheckBox = DirectCast(row.FindControl("chkApprove"), CheckBox)
next
Try 2:
Dim rowcount As Integer = grv_orders.Rows.Count
...
Go to the complete details ...