0
Answer

Iterate through check boxes on a repeater control in code behind

Simes

Simes

18y
2.4k
1
Hi,

I am new to web development and would appreciate some help here.  I am dynamic creating check boxes through ASP.net and would like to know how I iterate through them in my code behind to know which ones have been chceck and unchecked.  please help if you can.  Below is a code snippet from the ASPx part:

<asp:repeater id=rptBelbinMaster runat="server">
<headertemplate>
<table class="datagridNormal" width="100%" border="1" >

<tr><th align="Left">Question Code</th>

 

<th align="Left">

Question</th>

</tr>

</headertemplate>

<itemtemplate>

<tr class="datagridNormal" width="100%">

<td align="Left"><%# DataBinder.Eval(Container.DataItem, "prpQuestionCode")%>

</td>

<td align="Left" width="90%"><%# DataBinder.Eval(Container.DataItem, "prpQuestionText")%>

</td>

</tr>

<!-- The below enables the child repeater to see the content of objAnswers.-->

<asp:repeater runat="server" datasource='<%# DataBinder.Eval(Container.DataItem, "prpAnswers") %>'>

<headertemplate>

<table class="datagridSecondary" width="100%" border="1" >

<tr>

<th align="Left">

Answer Code</th>

<th align="Left">

Answer</th>

</tr>

</headertemplate>

<itemtemplate>

<tr class="datagridSecondary" width="100%">

<!-- The below enables the child repeater to see the content of objAnswers.-->

<td>

<input type="checkbox" id="chkAnswer<%# ((System.Collections.Generic.KeyValuePair<int,clsAnswer>)(Container.DataItem)).Value.prpDetailID %>" />

</td>