zoukankan      html  css  js  c++  java
  • DataPager控件使用

    APSX:

     1 <asp:ListView ID="LvResult" runat="server"        onpagepropertieschanging="LvResult_PagePropertiesChanging" >
     2     .......
     3 </asp:ListView>
     4 <asp:DataPager runat="server"  ID="ContactsDataPager" PageSize="10" PagedControlID="LvResult"> 
     5     <Fields> 
     6         <asp:NextPreviousPagerField ShowFirstPageButton="true" ShowLastPageButton="False" 
     7                    FirstPageText="首页" LastPageText="尾页" 
     8                    NextPageText="下一页" PreviousPageText="上一页" ShowNextPageButton="False" ButtonType="Link" />
     9         <asp:TemplatePagerField> 
    10             <PagerTemplate>
    11                 <b><%# Container.TotalRowCount>0 ? (Container.StartRowIndex / Container.PageSize) + 1 : 0 %></b>
    12             </PagerTemplate>
    13         </asp:TemplatePagerField> 
    14         <asp:NextPreviousPagerField ShowFirstPageButton="False" ShowLastPageButton="True" 
    15                    FirstPageText="首页" LastPageText="尾页"  
    16                    NextPageText="下一页" PreviousPageText="上一页" ShowNextPageButton="True" ShowPreviousPageButton="False" />
    17         <asp:TemplatePagerField>
    18             <PagerTemplate> 
    19                 <b><%# Math.Ceiling ((double)Container.TotalRowCount / Container.PageSize) %>页 ( 共<%# Container.TotalRowCount%>条记录   每页<%# Container.PageSize%>条) </b> 
    20             </PagerTemplate> 
    21         </asp:TemplatePagerField> 
    22     </Fields> 
    23 </asp:DataPager> 

    CS:

     1 protected void BtnSearch_Click(object sender, EventArgs e)
     2 {
     3     ContactsDataPager.SetPageProperties(0, 10, false);
     4     BindData();
     5 }
     6 protected void LvResult_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e)
     7 {
     8     ContactsDataPager.SetPageProperties(e.StartRowIndex, e.MaximumRows, false);
     9     BindData();
    10 }
    11 private void BindData()
    12 {
    13     ......
    14 }
  • 相关阅读:
    抓取网页数据C#文件
    ListView嵌套GridView使用详解及注意事项
    listView里面添加gridview
    动态加载图片的Adapter
    如何使用Photoshop(PS)将图片的底色变为透明
    无需序列号安装Photoshop CS6
    Objective-C中.h文件、.m文件中@interface、@synthesize及其它
    Android studio sha1
    Tool bar
    onActivityResult 通过case对不同情况进行处理
  • 原文地址:https://www.cnblogs.com/zhuhc/p/3455083.html
Copyright © 2011-2022 走看看