日期:2014-05-18  浏览次数:20902 次

gridview全选框
<asp:TemplateField HeaderText="<input type='checkbox' onclick='javascript:CheckAll(this)' />">
  <HeaderStyle HorizontalAlign="Center" Width="30px" Height="35px" />
  <ItemStyle HorizontalAlign="Center" Width="30px" />
  <ItemTemplate>
  <asp:CheckBox ID="ChkSel" runat="server" onclick='document.getElementById(this.id.replace("_ChkSel","_TxtSL")).disabled = !this.checked' />
  </ItemTemplate>
  </asp:TemplateField>

全选能用,删除也没问题,就是单机每个checkbox的时候都会弹出个
Microsoft JScript 运行时错误: 'document.getElementById(...)' 为空或不是对象
到底怎么解决呢?
求解!!谢谢各位了

------解决方案--------------------
this.id.replace("_ChkSel","_TxtSL") 这个控件ID找不到
------解决方案--------------------
应该是控件ID找不到, 你看下源码~~~