GridView,Repeater分页控件:WebPager(开源)
一、特点:
可以用在母板、MS Ajax等控件嵌套的任何地方,支持GridView,Repeater等数据控件的分页。
二、属性:
1. PagerStyle: 设置分页样式(NextPrev,NumericPages)
2. ControlToPaginate: 指定要实现分页的控件ID(数据控件本身不需要进行数据绑定了,只需对WebPager进行数据绑定就行了)
3. PageSize: 获取或设置要在单页上显示的项数
4. CurrentPageIndex: 获取或设置当前页的索引
三、事件:
1. OnPageIndexChanged: 执行分页时触发的分页事件
四、源码下载
五、示例: (Repeater用法于此类似)
<asp:GridView ID="GridView1" runat="server" Width="100%" AutoGenerateColumns="true"
OnRowDataBound="GridView1_RowDataBound" AllowSorting="True" OnSorting="GridView1_Sorting">
<PagerSettings Visible="False" />
</asp:GridView>
<cc1:WebPager ID="WebPager1" runat="server" PagerStyle="NextPrev" ControlToPaginate="GridView1"
PageSize="5" OnPageIndexChanged="WebPager1_PageIndexChanged" />
OnRowDataBound="GridView1_RowDataBound" AllowSorting="True" OnSorting="GridView1_Sorting">
<PagerSettings Visible="False" />
</asp:GridView>
<cc1:WebPager ID="WebPager1" runat="server" PagerStyle="NextPrev" ControlToPaginate="GridView1"
PageSize="5" OnPageIndexChanged="WebPager1_PageIndexChanged" />
Page事件
Gridview ----------------------------------------------------------
Gridview ----------------------------------------------------------