looping through checkboxes and inserting checkbox values to DB
Posted
by
user1150440
on Stack Overflow
See other posts from Stack Overflow
or by user1150440
Published on 2012-04-14T04:28:14Z
Indexed on
2012/04/14
5:29 UTC
Read the original article
Hit count: 188
ASPX Page:
<asp:ListView ID="lvSubjects" runat="server" >
<LayoutTemplate>
<asp:PlaceHolder ID="itemPlaceholder" runat="server" />
</LayoutTemplate>
<ItemTemplate>
<asp:CheckBox ID="cbRegularSubjects" Text=<%# Eval("SubjectName") %> runat="server" />
</ItemTemplate>
<AlternatingItemTemplate>
<asp:CheckBox ID="cbRegularSubjects" Text=<%# Eval("SubjectName") %> runat="server" />
</AlternatingItemTemplate>
</asp:ListView>
Code Behind:
For Each ctrl As Control In Page.Controls
If TypeOf ctrl Is CheckBox AndAlso CType(ctrl, CheckBox).Checked Then
'**Here I want to get the text of the check box and insert into the DB**
End If
Next
Where am i going wrong??i do not get any error...but this code is not working for me.
© Stack Overflow or respective owner