Hi, I have an <asp:Update Panel> with a <asp:GridView> in it, in the Gridview is an <asp:TempleteField>, in this is an <ItemTemplete> with a <ASP:CheckBox ID="1"> in it. The checkbox has 'AutoPostBack="True" OnCheckedChanged="Function1" '. In Function1 I get the value of the checkbox and update the database table with the checkbox value.
This works fine.
But I have copy / pasted the above with just ID's changed, datafield's, DataSourceID, etc, changed as a new Update panel, etc and a new code behind function "Function2" which itself is copy / paste of Function1 but writing to a diffent table.
The issue is both were working fine for the last week or so but now the second Update panel's checkbox has stopped firing the OnCheckBoxChanged event! Even under debugging, setting break points on Function1 and Function2, it only hits Function1 when a checkbox is changed, changing a checkbox in the second update panel no longer fires the Function2 code behind.
In short, dispite almost identical .aspx and .cs code one fires its onChanged event the other doesn't, this should not be possible. Same code but only one fires?
Visual studio Express 2010, Asp.net, C# 4.0
working code
<asp:TemplateField ControlStyle-Width="55px" ItemStyle-Width="55px" HeaderText="Approved?"><ItemTemplate><asp:CheckBox ID="ApprovedChkBox" DataField="Approved" Checked='<%# Bind("Approved") %>' SortExpression="Approved" runat="Server" AutoPostBack="True" OnCheckedChanged="ApprovedCheckBox_CheckedChanged" /></ItemTemplate><EditItemTemplate></EditItemTemplate></asp:TemplateField>
working code behind:
protected void ApprovedCheckBox_CheckedChanged(object s, EventArgs e) { }
non working code:
<asp:TemplateField ControlStyle-Width="55px" ItemStyle-Width="55px" HeaderText="Valet Booked / Done"><ItemTemplate><asp:CheckBox ID="valetChkBox" DataField="valetDone" Checked='<%# Bind("valetDone") %>' SortExpression="valetDone" runat="Server" AutoPostBack="True" OnCheckedChanged="valetDoneChkBox_CheckedChanged" /></ItemTemplate><EditItemTemplate></EditItemTemplate></asp:TemplateField>
not firing code behind
protected void valetDoneChkBox_CheckedChanged(object s, EventArgs e) { }