J
jim.long
I can't seem to get the checked value from the checkboxes! Is there
something wrong with the code? It loops through the repeater item
collection correctly.
HTML:
<asp:repeater id="rPrinterJobs" runat="server">
<ItemTemplate>
<tr>
<td><asp:CheckBox ID="chkboxSelection" Checked=true Runat="server"
Enabled="true"></asp:CheckBox>
<asp:Label ID="hdnStoreID" Visible="false" Text='<%#
DataBinder.Eval(Container.DataItem, "UColumn0") %>'
Runat=server></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:repeater>
Code Behind:
Dim DataItem As RepeaterItem
Dim chkSelected As System.Web.UI.WebControls.CheckBox
Dim strJobID As String
Dim rc As RepeaterItemCollection = rPrinterJobs.Items
Dim MyCheckBox As CheckBox
For Each Item As RepeaterItem In rc
MyCheckBox = CType(Item.FindControl("chkboxSelection"),
CheckBox)
If MyCheckBox.Checked = True Then
strJobID = CType(Item.FindControl("hdnStoreID"),
Label).Text
If strJobID > "" Then
'Do something
End If
End If
Next
something wrong with the code? It loops through the repeater item
collection correctly.
HTML:
<asp:repeater id="rPrinterJobs" runat="server">
<ItemTemplate>
<tr>
<td><asp:CheckBox ID="chkboxSelection" Checked=true Runat="server"
Enabled="true"></asp:CheckBox>
<asp:Label ID="hdnStoreID" Visible="false" Text='<%#
DataBinder.Eval(Container.DataItem, "UColumn0") %>'
Runat=server></asp:Label>
</td>
</tr>
</ItemTemplate>
</asp:repeater>
Code Behind:
Dim DataItem As RepeaterItem
Dim chkSelected As System.Web.UI.WebControls.CheckBox
Dim strJobID As String
Dim rc As RepeaterItemCollection = rPrinterJobs.Items
Dim MyCheckBox As CheckBox
For Each Item As RepeaterItem In rc
MyCheckBox = CType(Item.FindControl("chkboxSelection"),
CheckBox)
If MyCheckBox.Checked = True Then
strJobID = CType(Item.FindControl("hdnStoreID"),
Label).Text
If strJobID > "" Then
'Do something
End If
End If
Next