Hi I have a repeater and an unbound checkbox in each item. I want to do something for items that are checked. but the problem is here! when I click on my button outside the repeater, just my page refreshes and nothing happens.
these are my code :
<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>
<asp:CheckBox ID="ChBox" runat="server" />
<asp:Label ID="rptBody" runat="server" Text='<%#Eval("subject") %>
<hr />
</ItemTemplate>
</asp:Repeater>
<asp:Button ID="btnDelete" runat="server" Text="Delete" Width="90px" onclick="btnDelete_Click" />
code in cs file :
protected void btnDelete_Click(object sender, EventArgs e)
{
foreach (RepeaterItem item in Repeater1.Items)
{
CheckBox ch = item.FindControl("ChBox") as CheckBox;
if (ch.Checked)
{
ch.Text = "IT is selected now";
}
}
}