我加上ASPNETPager控件后设置PageSize为10不起作用
我的页面代码如下:
<table align="center" border="1" cellpadding="0" cellspacing="0" style="height: 60px;">
            <tr>
                <th>编号</th>
                <th>上级编号</th>
                <th>排序编号</th>
                <th>栏目名称</th>
                <th>管理</th>
            </tr>
    <asp:Repeater ID="RPChannelList" runat="server">
    <HeaderTemplate>    
    </HeaderTemplate>
    <ItemTemplate>
        <tr>
            <td><%#Eval("ChannelID") %></td>
            <td><%#Eval("TopID") %></td>
            <td><%#Eval("OrderNum") %></td>
            <td><%#Eval("ChannelName") %></td>
            <td>
            <a href="?cmd=del&ChannelID=<%#Eval("ChannelID") %>">删除</a>
            <a href="Channel_Mod.Aspx?&ChannelID=<%#Eval("ChannelID") %>">修改</a>
            </td>
        </tr>
    </ItemTemplate>
    <FooterTemplate></FooterTemplate> 
    </asp:Repeater>
    </table>
    <webdiyer:AspNetPager ID="AspNetPager1" runat="server" 
        onpagechanged="AspNetPager1_PageChanged" FirstPageText="首页" 
    LastPageText="尾页" NextPageText="后页" PageIndexBoxType="TextBox" 
    PrevPageText="前页" ShowBoxThreshold="1" ShowPageIndexBox="Always" 
    SubmitButtonText="Go" TextAfterPageIndexBox="页" TextBeforePageIndexBox="转到" 
        EnableTheming="True" NumericButtonCount="5" LayoutType="Table" AlwaysShow="True">
    </webdiyer:AspNetPager>
.cs文件中代码如下:
void BindData()
        {
            DataTable coms = BLL.Channel.GetAll();
            AspNetPager1.RecordCount = coms.Rows.Count;
            PagedDataSource pds = new PagedDataSource();
            pds.AllowPaging = true;
            pds.PageSize = AspNetPager1.PageSize;
            pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1;
            pds.DataSource = coms.Rows;
            RPChannelList.DataSource = pds;
            RPChannelList.DataBind();
            if (AspNetPager1.RecordCount < AspNetPager1.PageSize)
            {
                AspNetPager1.AlwaysShow = true;
            }
希望大家帮帮忙,很急!
        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindData();
        }

解决方案 »

  1.   

    PageSize="10" 
    AlwaysShow="True"                                 OnPageChanged="AspNetPager1_PageChanged"AspNetPager1.RecordCount = list.Count;
    //分页查询数据
    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
      {
      BindData();
      }
      

  2.   

    首先谢谢各位的回答,但是,这些好像都不是问题的本质,加上这些属性也不起作用,我其实想问的是aspnetpager控件怎样给"table"分页,麻烦各位高手了
      

  3.   

    惭愧,我看来看去还是没看懂楼主到底是什么问题。为table分页?你现在的代码不就是用table吗?
      

  4.   

    你看看这个吧,或许对你有帮助http://blog.csdn.net/BossDarcy/archive/2010/11/18/6019601.aspx
      

  5.   

    我也没搞懂lz的意思,要分页的话一楼的做法就对啊,AspNetPager控件中都没设置PageSize="10" ,怎么可能分页