日期:2014-05-17  浏览次数:20463 次

GivdView中CheckBox全选问题
本帖最后由 Sealy497800473 于 2013-01-25 12:03:23 编辑
如题,页面有一个id为allChooseCB的全选CheckBox,想实现当勾选后,GirdView1中一列CheckBox全部选中,但是出现了未将对象引用设置到对象的实例,代码如下,请高手看一下,问题出在哪,如何解决?
注:页面使用了母版页adminMain.master 控件放在可编辑模块concent中

前台源码

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AutoGenerateColumns="False" DataKeyNames="id,id1" 
                DataSourceID="concentSDS" CellPadding="4" ForeColor="#333333" 
                GridLines="None" Width="100%">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:TemplateField HeaderText="选择">
                        <ItemTemplate>
                                <input id="rowCb" type="checkbox" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="id" HeaderText="索引" InsertVisible="False" 
                        ReadOnly="True" SortExpression="id" ItemStyle-Width="5%">
        <ItemStyle Width="5%"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="classifyName" HeaderText="所属类别" 
                        SortExpression="classifyName" ItemStyle-Width="15%" >
        <ItemStyle Width="15%"></ItemStyle>
                    </asp:BoundField>
                    <asp:BoundField DataField="newsTitle" HeaderText="文章标题" 
                        SortExpression="newsTitle" ItemStyl