Selecting a gridview row not working in IE but works in Firefox

走远了吗. 提交于 2020-01-06 15:29:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!