Hello everyone.
Scenario:
I have a simple GridView with an ItemTemplateField which has a Checkbox in it. Such Checkbox is wired to fire the onCheckedChanged event, which for some reason I ignore, only fires when checking, but not unchecking. In turn, every onCheckedChanged event of such nature get cued some how, somewhere, and fire in sequence after another control triggers its on server side event.
Anyhow, that's not the question. Here's the grid, and as you can see, the checkbos is not bound to any data source:
<asp:GridView ID="Grid" runat="server" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField Visible="false">
<ItemTemplate><asp:Label id="lbCesionID" runat ="server" Text='<%# Eval("idCesion") %>' /></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate><asp:CheckBox runat="server" ID="chkSelected" AutoPostBack="true" OnCheckedChanged="GridCheckedChanged" Checked="false" /></ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DBSourceField" HeaderText="ThisHeader" ></asp:BoundField>
</Columns>
</asp:GridView>
Looking a the html code,
I found this attached to my checkboxes:
onclick="javascript:setTimeout('__doPostBack(\'ctl00$MainContent$ucCesionesDocs$Grid$ctl02$chkSelected\',\'\')', 0)"
And since I have no clue how it got there, I am most certainly blaming it for my hurdle.
Does anybody know where does such thing comes from? Where could I possible be adding it without knowing. If so, how can I get rid of it?
Thank you for your help.
What I have tried:
Intercepting the OnRowDataBound event, locating the checkbox within the grid's row, and removing the "onclick" attribute, but that javascript call remains in place.
I found a setTimeout function defined in JQuery, but, again, I am not adding such thing (at least on purpose).