I'm having trouble getting selected rows in asp.net. i tried to debug it and found out that the answer to "chkRow.Checked" is always false eventhough it is selected. I'm new to asp.net.here is my code.
Protected Sub btnApproveYes_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnApproveYes.Click
Dim modID As String = String.Empty
For Each row As GridViewRow In gvModule.Rows
If row.RowType = DataControlRowType.DataRow Then
Dim chkRow As CheckBox = TryCast(row.Cells(0).FindControl("chkRow"), CheckBox)
If chkRow.Checked Then
modID = row.Cells(1).Text + "|"
End If
End If
Next
End Sub
<asp:GridView ID="gvModule" runat="server" AllowPaging="False"
AutoGenerateColumns="False" CssClass="gridView"
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkRow" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="mod_id" HeaderText="Module ID" />
<asp:BoundField DataField="mod_name" HeaderText="Module Name" />
<asp:BoundField DataField="mod_desc" HeaderText="Description" />
</Columns>
</asp:GridView>