If you want to read in a bunch of HTML checkboxes that are in a repeater using C# then you need to add a runat="server" element to you checkbox input tag. For example:
<asp:Repeater ID="MyRepaterList" runat="server"/>
<ItemTemplate>
<input type="checkbox" id="CheckboxName" value='<%# Eval("MyDatabaseValue") %>' runat="server" />
</ItemTemplate>
</asp:Repeater>
In your code behind you can now read in this element by using the following code:
using System.Web.UI.HtmlControls;
foreach (RepeaterItem currentControl in MyRepaterList.Items)
{
HtmlInputCheckBox MyCheckBox = new HtmlInputCheckBox();
MyCheckBox = (HtmlInputCheckBox)currentControl.FindControl("CheckboxName");
if (MyCheckBox.Checked)
{
//logic if checkbox is ticked here
}
}
The above code will loop through all the HTML checkbox elements within your repeater. You can easily modify this to let you look for HTML textboxes (HtmlInputText), HTML radio buttons (HtmlInputRadioButton), etc.
Member discussion