This has got me at my wit's end. I have a GridView with a column with a checkbox in it. The checkbox is set to call CheckedChanged and AutoPostBack is true.
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="cbNotifier" runat="server" OnCheckedChanged="cbNotifier_CheckedChanged" AutoPostBack="true" />
</ItemTemplate>
</asp:TemplateField>
I am using similar code in the first column of the GridView and it works perfectly. I am using the code above in a different column. It does not work. Instead of rendering the checkbox to do a postback, it renders a span around the checkbox like this:
<span AutoPostBack="true"><input id="cbNotifier" type="Checkbox"></span>
so, of course, the checkbox will not postback.
If I add another, identical checkbox to the same column, like this ...
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="cbNotifier" runat="server" OnCheckedChanged="cbNotifier_CheckedChanged" AutoPostBack="true" />
<asp:CheckBox ID="cbNotifier1" runat="server" OnCheckedChanged="cbNotifier_CheckedChanged" AutoPostBack="true" />
</ItemTemplate>
</asp:TemplateField>
... the second checkbox postsback perfectly, the first one gets the span tag around it. What on earth is going on?
Aucun commentaire:
Enregistrer un commentaire