Reputation: 3945
Using a repeater, which displays a list, which includes a checkbox field. When a checkbox is clicked I want the function to run and display the label....trying to debug this but cant seem to get it going, using breakpoint wont pick up the function
//code behind
protected void chkMyCheck_CheckedChanged(object sender, EventArgs e)
{
label.Text = "Button Clicked";
}
aspx:
<asp:Repeater id="rptSelectedUtilities" runat="server">
<HeaderTemplate>
<table class="detailstable FadeOutOnEdit">
<tr>
<th style="width:200px;">Utility</th>
<th style="width:200px;">Contacted</th>
<th style="width:200px;">Comment</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<th style="width:200px;"><%# Eval("Name") %></th>
<th style="width:200px;"><asp:CheckBox ID="chkMyCheck" AutoPostBack="true" runat="server" OnCheckedChanged="chkMyCheck_CheckedChanged" Checked='<%# Convert.ToBoolean(Eval("Checked")) %>'/></th>
<th style="width:200px;"><%# Eval("Comment") %></th>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Label id="labelTableEmpty" runat="server" Text="There are currently no items in this table." />
<asp:Label ID ="label" runat="server" />
Any idea as to why the code doesnt go into the chkMyCheck_CheckedChanged function when a checkbox is clicked?, the page does re-fresh so its picking up auto post back
Upvotes: 0
Views: 173
Reputation:
Are you bind repeater inside of !IsPostBack ????
for
void page_load()
{
if(!IsPostBack)
{
//BindRepeater method???
}
}
Upvotes: 1