各位高人,帮帮小弟,我头都快想破了……
我在DataGrid中加上:
<asp:datagrid id="dgtDrawTemp" runat="server" Width="100%" PageSize="3" BorderColor="#9CA9D1" BorderWidth="2px" CellSpacing="1"> <FooterStyle BackColor="#9CA9D1"></FooterStyle>
<HeaderStyle Font-Size="10pt" Wrap="False" HorizontalAlign="Center" BackColor="#BFDFFF"></HeaderStyle>
<ItemStyle Font-Size="10pt"></ItemStyle>
<Columns>
<asp:TemplateColumn HeaderText="确认">
<ItemTemplate>
<asp:CheckBox ID="chkSelected" Runat="server" ></asp:CheckBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
判断CheckBox有没有选定的操作: (我的CheckBox在第一行)
Dim ch As CheckBox = CType(dgtDrawTemp.Items(0).Cells(0).FindControl("chkSelected"), CheckBox)
If ch.Checked Then
Response.Write("Checked")
Else
Response.Write("NO")
End If
为什么我用鼠标选了CheckBox,提交后它不会执行IF部分,只执行ELSE部分??