<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(...)' 为空或不是对象
到底怎么解决呢?
求解!!谢谢各位了

解决方案 »

  1.   

    this.id.replace("_ChkSel","_TxtSL")  这个控件ID找不到
      

  2.   


    确实啊,没有那个TxtSL,那个地方到底应该是什么?
    我看很多人都这么写的,难道大家都没报错么?
      

  3.   


    确实啊,没有那个TxtSL,那个地方到底应该是什么?
    我看很多人都这么写的,难道大家都没报错么?
      

  4.   

    蛋疼!自己弄出来了!结贴!怒气!
    <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" />
                    </ItemTemplate>
                </asp:TemplateField>