问题
I have a gridview with checkbox as first column. Whenever I click anywhere in the gridview row (if clicked in checkbox) it should get selected and gridviewrow_selectedindexchanged() method will get invoked.
This is working fine in Firefox. When I click the checkbox in gridview, the row in which checkbox lies will get selected and gridviewrow_selectedindexchanged() will get invoked.
But this is not working in IE. When I click the checkbox, the row is not getting selected and gridviewrow_selectedindexchanged() is not getting invoked. But if I click anywhere else other than checkbox in the gridview row, the row is getting selected.
Code used for selecting a row.
gridview.Rows[i].Attributes.Add("onclick", ClientScript.GetPostBackEventReference(gridview, "Select$" + i));
Code for checkbox in aspx page
<asp:TemplateField HeaderText="Select" >
<HeaderTemplate >
<asp:CheckBox ID="chkboxSelectAll" runat="server" onclick="CheckAllEmp(this);" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true" />
</ItemTemplate>
</asp:TemplateField>
Can anyone help me to resolve this issue?
Thanks in advance.
来源:https://stackoverflow.com/questions/20801455/selecting-a-gridview-row-not-working-in-ie-but-works-in-firefox