浅谈VS中的DataPager分页 -电脑资料

电脑资料 时间:2019-01-01 我要投稿
【meiwen.anslib.com - 电脑资料】

    这篇文章主要介绍了浅谈VS中的DataPager分页的相关资料和示例,需要的朋友可以参考下

    微软的DataPager分页功能很强大,不要设置数据库存储过程,只要添加个DataPager控件,关联下要分页的控件,简单设置就可以有不错的分页效果,

浅谈VS中的DataPager分页

。当然要有更理想的效果还是要前台和后台处理下。

    winform下的DataPager 显示模式:

   

    webForm下的样式由TemplatePagerField,NextPreviousPagerField和NumericPagerField控制

    通过设置上面几个控件的配合也可以达到winForm下的效果,这3个控件中最重要的是TemplatePagerField控件。

    下面简单看看TemplatePagerField控件可以怎么设置:

    代码如下:

    <%@ Page language="VB" %>

   

    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

   

   

   

    TemplatePagerField.OnPagerCommand Example

   

   

   

   

   

TemplatePagerField.OnPagerCommand Example

   

    DataSourceID="StoresDataSource"

    runat="server">

   

   

   

    ID

    Store Name

   

   

   

   

   

   

   

   

    ‘ />

   

   

    ‘ />

   

   

   

   

   

   

    ID="ContactsDataPager"

    PageSize="30"

    PagedControlID="StoresListView">

   

   

   

   

    Text="<<" Enabled=‘<%# Container.StartRowIndex > 0 %>‘ />

   

    Text=‘<%# (Container.StartRowIndex - Container.PageSize + 1) & " - " & (Container.StartRowIndex) %>‘

    Visible=‘<%# Container.StartRowIndex > 0 %>‘ />

   

    Text=‘<%# (Container.StartRowIndex + 1) & "-" & (IIf(Container.StartRowIndex + Container.PageSize > Container.TotalRowCount, Container.TotalRowCount, Container.StartRowIndex + Container.PageSize)) %>‘ />

   

    Text=‘<%# (Container.StartRowIndex + Container.PageSize + 1) & " - " & (IIf(Container.StartRowIndex + Container.PageSize*2 > Container.TotalRowCount, Container.TotalRowCount, Container.StartRowIndex + Container.PageSize*2)) %>‘

    Visible=‘<%# (Container.StartRowIndex + Container.PageSize) < Container.TotalRowCount %>‘ />

   

   

   

   

   

    ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"

    SelectCommand="SELECT [CustomerID], [Name] FROM Sales.Store ORDER BY [Name]">

   

   

   

   

最新文章