这是我的代码:
<asp:GridView ID="GridView1" class="table table-bordered table-hover" OnRowUpdating="OnRowUpdating" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
runat="server" AutoGenerateColumns="false">
<Columns>
<asp:templatefield HeaderText="Action">
<itemtemplate>
<asp:checkbox name="cbSelect" ID="cbSelect" Text="Reject" runat="server"/>
</itemtemplate>
</asp:templatefield>
<asp:BoundField DataField="Nourut" HeaderText="NO" ItemStyle-Width="30" />
<asp:BoundField DataField="Tgltrans" HeaderText="TANGGAL" ItemStyle-Width="150" />
<asp:BoundField DataField="Noref" HeaderText="Noref" ItemStyle-Width="150" />
<asp:BoundField DataField="KDTRANS" HeaderText="KDTRANS" ItemStyle-Width="30" />
<asp:BoundField DataField="SRNTRANS" HeaderText="SRNTRANS" ItemStyle-Width="150" />
<asp:BoundField DataField="NOREFORI" HeaderText="NOREFORI" ItemStyle-Width="150" />
<asp:BoundField DataField="NOMINAL" HeaderText="NOMINAL" ItemStyle-Width="30" />
<asp:BoundField DataField="KET" HeaderText="KET" ItemStyle-Width="150" />
<asp:BoundField DataField="PPENGAS" HeaderText="PPENGAS" ItemStyle-Width="150" />
<asp:BoundField DataField="SNDKOTAS" HeaderText="SNDKOTAS" ItemStyle-Width="30" />
<asp:BoundField DataField="PPENGPEN" HeaderText="PPENGPEN" ItemStyle-Width="150" />
<asp:BoundField DataField="PPENAKH" HeaderText="PPENAKH" ItemStyle-Width="150" />
<asp:BoundField DataField="SNDKOTTUJ" HeaderText="SNDKOTTUJ" ItemStyle-Width="150" />
<asp:BoundField DataField="PPENPEN" HeaderText="PPENPEN" ItemStyle-Width="150" />
<asp:BoundField DataField="PNAMA" HeaderText="PNAMA" ItemStyle-Width="30" />
<asp:BoundField DataField="PNOREK" HeaderText="PNOREK" ItemStyle-Width="150" />
<asp:BoundField DataField="PNOID" HeaderText="PNOID" ItemStyle-Width="150" />
<asp:BoundField DataField="PJNSNSBH" HeaderText="PJNSNSBH" ItemStyle-Width="150" />
<asp:BoundField DataField="PJSTATPEN" HeaderText="PJSTATPEN" ItemStyle-Width="150" />
<asp:BoundField DataField="PALMT" HeaderText="PALMT" ItemStyle-Width="30" />
<asp:BoundField DataField="PNAMA2" HeaderText="PNAMA2" ItemStyle-Width="150" />
<asp:BoundField DataField="PNOREK2" HeaderText="PNOREK2" ItemStyle-Width="150" />
<asp:BoundField DataField="PNOID2" HeaderText="PNOID2" ItemStyle-Width="150" />
<asp:BoundField DataField="PJNSNSBH2" HeaderText="PJNSNSBH2" ItemStyle-Width="150" />
<asp:BoundField DataField="PJSTATPEN2" HeaderText="PJSTATPEN2" ItemStyle-Width="30" />
<asp:BoundField DataField="PALMT2" HeaderText="PALMT2" ItemStyle-Width="150" />
</Columns>
</asp:GridView>
</div>
<asp:Button ID="Button1" runat="server" Text="Reject By Checked" />
<asp:Button ID="Button2" runat="server" Text="Reject All" />
这是我的vb代码:
Dim chk As CheckBox = CType(GridView1.Rows(0).FindControl("cbSelect"), CheckBox)
If (chk.Checked) Then
'carac = "True"
MsgBox("test")
End If
我试图从&#34; cbSelect&#34;获得布尔值,但总是返回false,我尝试从互联网上的任何解决方案,但仍然无法正常工作, 你能告诉我我的代码会发生什么吗?感谢