Quando l'utente fa clic sul pulsante "Salva modifiche", ho bisogno di ottenere i valori di tutte le checkbox all'interno di un ripetitore. Se non riesco a ottenere i valori, l'ID è ok.Ottieni i valori di tutte le checkbox nel ripetitore
Codice a pagina:
<ul class="bulletless">
<asp:Repeater runat="server" ID="newsletter_repeater">
<ItemTemplate>
<li><input type="checkbox" value='<%#Eval("id")%>' id='<%#Eval("id")%>'/> <%#Eval("displayTitle")%></li>
</ItemTemplate>
</asp:Repeater>
</ul>
<asp:Button runat="server" CssClass="editButtonOff" Text="Save Changes" ID="SaveNewsletterChanges" OnClick="SaveNewsletterChanges_submit" />
Qui è il mio codice dietro:
protected void SaveNewsletterChanges_submit(object sender, EventArgs e)
{
//the count of the items in the repeater is 2
//but the aItem is null
foreach(RepeaterItem aItem in newsletter_repeater.Items){
string myId = aItem.ID;
}
}
Che cosa sto facendo di sbagliato?