..无法分页..页码也有链接了./..但是点了以后没有反应...不知道哪里错了... private void pageload()
{
    string strSql="SELECT * FROM Film_info WHERE display=1 ORDER BY id DESC";
        DataView dvList=DbHelper.GetDataView(strSql) ;//数据绑定的方法..自定义类里面
    AspNetPager1.RecordCount=dvList.Table.Rows.Count;
    Session["dvList"]=dvList;
    dataBind();
}
private void dataBind()
{
    PagedDataSource pds=new PagedDataSource();
    pds.AllowCustomPaging=true;
    pds.PageSize=AspNetPager1.PageSize;
    pds.CurrentPageIndex=AspNetPager1.CurrentPageIndex-1;
    pds.DataSource=(DataView)Session["dvList"];
    dgList.DataSource= pds;
    dgList.DataBind();
}
public void AspNetPager1_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
{
    AspNetPager1.CurrentPageIndex=e.NewPageIndex;
    dataBind();
}datagrid<asp:datagrid id="dgList" Runat="server" AllowCustomPaging="True" AutoGenerateColumns="False"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" BackColor="White" CellPadding="3" AllowPaging="True"
PageSize="5">
<FooterStyle ForeColor="#000066" BackColor="White"></FooterStyle>
<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#669999"></SelectedItemStyle>
<ItemStyle ForeColor="#000066"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="#006699"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="id" HeaderText="ID"></asp:BoundColumn>
<asp:BoundColumn DataField="film_Name" HeaderText="电影名称"></asp:BoundColumn>
<asp:BoundColumn DataField="folm_seecout" HeaderText="观看次数"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="操作">
<ItemTemplate>
<asp:CheckBox id="cbChoose" runat="server" Text="选择"></asp:CheckBox>
<a href='manger_editvod.aspx?Action=Edit&ID=<%# DataBinder.Eval(Container.DataItem,"id")%>'>
编辑</a>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle Visible="False" HorizontalAlign="Left" ForeColor="#000066" BackColor="White" Mode="NumericPages"></PagerStyle>
</asp:datagrid>
aspnetpager
<webdiyer:aspnetpager id="AspNetPager1" style="FONT-SIZE: 12px" runat="server" Width="95%" ShowCustomInfoSection="Left"
                            PrevPageText="上一页" PageSize="6" OnPageChanged="AspNetPager1_PageChanged" NumericButtonCount="5" NextPageText="下一页"
                            LastPageText="尾页" InputBoxStyle="width:19px" HorizontalAlign="right" FirstPageText="首页" CustomInfoHTML="共有  <b><font color='red'>%RecordCount%</font></b>  条记录 当前页<b><font color='red'>%CurrentPageIndex%</font>/%PageCount%</b>   次序 %StartRecordIndex%-%EndRecordIndex%"
                            AlwaysShow="True"></webdiyer:aspnetpager>
 
 
 

解决方案 »

  1.   

    是不是这个的问题startIndex endIndex?
      

  2.   

    if (!IsPostBack)
            {
                pageload();
            }
      

  3.   

    我好像和你说过这个问题了,分页控件只管分页调用下面的方法:
    public void AspNetPager1_PageChanged(object src, Wuqi.Webdiyer.PageChangedEventArgs e)
    {
        AspNetPager1.CurrentPageIndex=e.NewPageIndex;
        dataBind();
    }
    至于如何绑定数据,需要自己写逻辑。更重要的是要自己写如何获取分页数据(就是如何获取每一页上的数据)。
    你下面的数据绑定,每次都是绑定相同的数据(根本就不是分页)private void dataBind()
    {
        PagedDataSource pds=new PagedDataSource();
        pds.AllowCustomPaging=true;
        pds.PageSize=AspNetPager1.PageSize;
        pds.CurrentPageIndex=AspNetPager1.CurrentPageIndex-1;
        pds.DataSource=(DataView)Session["dvList"];
        dgList.DataSource= pds;
        dgList.DataBind();
    }下面是我的代码,你看看:protected void Page_Load(object sender, EventArgs e)
        {
    AspNetPager1.RecordCount = DataOperator.GetPtypeCountByPtypeID(int.Parse(id));//获取总页数
            AspNetPager1.PageSize = ApplicationConstes.PageSize;//设置每页的个数
        }    protected void AspNetPager1_PageChanged(object sender, EventArgs e)//页面变化过程
        {
            bindData(AspNetPager1.StartRecordIndex, AspNetPager1.EndRecordIndex);//数据绑定(StartRecordIndex是记录开始的位置,EndRecordIndex是记录结束的位置)
        }    private void bindData(int startindex, int recordcount)
        {
            Obj.SelectParameters[0].DefaultValue = startindex.ToString();
            Obj.SelectParameters[1].DefaultValue = recordcount.ToString();
            Obj.SelectParameters[2].DefaultValue = Request.QueryString["id"];
            Repeater1.DataSource = Obj;
            Repeater1.DataBind();
        }前台页面:<asp:Repeater ID="Repeater1" runat="server" EnableViewState="False">
                    <HeaderTemplate>
                        <table class="GridViewCss" cellspacing="0" cellpadding="0" width="513px" rules="rows"
                            style="border-collapse: collapse;">
                    </HeaderTemplate>
                    <ItemTemplate>
                        <tr style="border-style: none">
                            <td class="PtypeCss">
                                <%#DataBinder.Eval(Container.DataItem,"Ptype")%>
                            </td>
                            <td class="CityCss">
                                <%#DataBinder.Eval(Container.DataItem,"City")%>
                                <%#DataBinder.Eval(Container.DataItem,"Block")%>
                            </td>
                            <td class="BtypeCss">
                                <%#DataBinder.Eval(Container.DataItem,"Btype")%>
                            </td>
                            <td class="TitleCss">
                                <%#DataBinder.Eval(Container.DataItem,"Title")%>
                            </td>
                            <td class="PriceCss">
                                <%#DataBinder.Eval(Container.DataItem,"Price")%>
                                <%#DataBinder.Eval(Container.DataItem,"PUnit")%>
                            </td>
                            <td class="IdentityCss">
                                <%#DataBinder.Eval(Container.DataItem,"Identity")%>
                            </td>
                            <td>
                                <a class="LookCss" href="/FangWuZhongJie/Housing/HouseInfo<%#DataBinder.Eval(Container.DataItem,"InfoID")%>.aspx">
                                查 看</td>
                        </tr>
                    </ItemTemplate>
    </asp:Repeater><webdiyer:AspNetPager ID="AspNetPager1" runat="server" ShowFirstLast="False" ShowPrevNext="False"
                    EnableUrlRewriting="True" UrlRewritePattern="~/Housing-Information/Property-%id%/Houses-List-{0}.aspx"
                    CssClass="pagercss" OnPageChanged="AspNetPager1_PageChanged" CenterCurrentPageButton="True" LayoutType="Table">
                </webdiyer:AspNetPager>
                <asp:ObjectDataSource ID="Obj" TypeName="Fang.WebInfoBLL.WebInfoOperator" EnableCaching="true"
                    CacheDuration="120000" CacheExpirationPolicy="Absolute" SelectMethod="GetWebInfoByPtypeAndPages"
                    runat="server">
                    <SelectParameters>
                        <asp:Parameter Name="startRowIndex" Type="Int32" />
                        <asp:Parameter Name="maximumRows" Type="Int32" />
                        <asp:Parameter DefaultValue="0" Name="id" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
    <!--GetWebInfoByPtypeAndPages是自己写的分页逻辑-->
      

  4.   

    其实这里的分页不是利用的.net数据控件的分页,而是每次点击AspNetPager控件来触发事件。在时间的存储过程中获取现相应的数据,然后将它绑定到Repeater、DataList、GridView。
    明白了原理,就算是不是用任何数据控件也可以实现分页效果。
    LZ好好看看吧
      

  5.   

    AspNetPager1_PageChanged
    确认是这个事件么?
      

  6.   

    加上事件关联的代码
    如:contr.click+=new eventhandler(functionName);
      

  7.   

    在那个地方打个短点试试,我也遇到这个问题了。不过我的datalist是放在updatapanel里的,不是知是不是它的问题。我的打了短点,但激发事件就是不在那个地方停下来,真是郁闷。。