Handling checkboxes in Repeater Control

I

Imran Aziz

Hello All,
I have added html checkboxes in each row of the repeater control that I
draw on the page. Now when I want to find out if the check boxes have been
checked or not, I cannot seem to access them. Can anyone please guide me how
to access child items in a repeater control.

Here is my code.

<ASP:Repeater id="lstOtherRepeater" runat="server" >

<HeaderTemplate>

<Table width="100%" >

</HeaderTemplate>

<ItemTemplate>

<tr >

<td>

<input id="chkChannelID" type="checkbox" value="<%#
DataBinder.Eval(Container.DataItem, "nChannelID") %>"/><a
href="showitems.aspx?nChannelID=<%# DataBinder.Eval(Container.DataItem,
"nChannelID") %>" ><%# DataBinder.Eval(Container.DataItem, "sChannelTitle")
%></a>

</td>

</tr>

<tr >

<td>

<%# DataBinder.Eval(Container.DataItem, "sChannelDescription")%>

</td>

</tr>

</ItemTemplate>

<FooterTemplate>

</Table>

</FooterTemplate>

</ASP:Repeater>

How can access the checkboxes in my code behind.

Thanks a lot.


Imran.
 
B

Brock Allen

foreach(RepeaterItem i in lstOtherRepeater.Items)
{
HtmlInputCheckBox c = i.FindControl("chkChannelID") as HtmlInputCheckBox;
if (c != null)
{
bool b = c.Checked;
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top