I have a grid with repeater:
<asp:Repeater ID="rtInlineBlock" runat="server">
<ItemTemplate>
<div class="block">
<asp:HiddenField ID="idDirectorio" runat="server" Value='<%# Eval("guid") %>' />
<asp:HiddenField ID="isFolder" runat="server" Value='<%# Eval("isFolder") %>' />
<asp:ImageButton ID="btSend" runat="server" ImageUrl='<%# Eval("imgPath") %>' OnClick="btSend_Click" />
<div class="bottom">
<asp:CheckBox ID="check" runat="server" OnCheckedChanged="check_CheckedChanged" AutoPostBack="true" />
<asp:Label ID="lblNome" runat="server" Text='<%# Eval("xInfo") %>' />
</div>
</div>
</ItemTemplate>
</asp:Repeater>
And my selection event:
protected void check_CheckedChanged(object sender, EventArgs e)
{
var cbSend = sender as CheckBox;
var rtItem = cbSend.Parent as RepeaterItem;
int cont = 0;
foreach (var item in rtInlineBlock.Items)
{
if (cbSend.Checked)
{
cont = cont + 1;
}
}
}
I tried this way, but it always picks up all the checkboxes, I just want the ones selected.