Site statistics
Members : 19Content : 104
Content View Hits : 18416
Who's Online
We have 308 guests online| Extend repeater to support Datapager |
|
|
|
| Articles - .net framework 3.5 |
| Written by Dot4Pro |
| Friday, 22 May 2009 02:30 |
Repeater 2.0Repeater is a databound control. In the terms of layout and desing, repeater is the most flexible control found on asp.net 2.0. You can completely customize the layout and desing with the tatal controls on html tags genereated on the browser. This type of flexiblity is not found on the other data boudn controls like gridview, datalist, etc. Instead Repeater 2.0 doesnot supports built-in paging and sorting functionality like gridview. In this article you will know how can we extend Repeater 2.0 to support paging with the DataPager 3.5.
Datapager 3.5Datapager 3.5 comes with .net framework 3.5 which is a seperate control to integrate with databound controls to support paging funtionalities. The requirement of DataPager can be associated with any databound controls that is implemented from System.Web.UI.WebControls.IPageableItemContainer Interface. .net framework provides only one control ListView (which is implemented from System.Web.UI.WebControls.IPageableItemContainer) to support with DataPager.
Extend Repeater 2.0 to associate with DataPagerHere are some steps you can follow to extend Repeater 2.0 or any DataBound controls to support paging with DataPager. 1. Create a custom web control. 2. Inherit it from the Repeater and implement System.Web.UI.WebControls.IPageableItemContainer. 3. Implement System.Web.UI.WebControls.IPageableItemContainer methods 4. Drag and drop the Custom Repeater and DataPager control and associate Custom Repeater to the DataPager. 5. Create Object Datasource and use for repeater as datasource. Need to enable Paging on Object Data source. The Following Code snnipet shows you how you can extend repeater and implement methods of System.Web.UI.WebControls.IPageableItemContainer to Support paging with DataPager. using System; Usage on WebPage: <%@ Register assembly="RepeaterX" namespace="RepeaterX" tagprefix="cc1" %>
DataProvider Class (Put this on app_code)
Components used:
You can find a way to dynamically get TotalRowCount instead of constant 100 value.
|
| Last Updated on Thursday, 17 December 2009 15:24 |


