Click here to Skip to main content
12,553,745 members (61,930 online)
Click here to Skip to main content
Add your own
alternative version


1 bookmarked

ListView and DataPager in ASP.NET 3.5

, 11 Oct 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
The ListView is a sort of hybrid between a DataGrid and Repeater thatcombines the free form templating of the Repeater with the editingfeatures

Editorial Note

This articles was originally at but has now been given a new home on CodeProject. Editing rights for this article has been set at Bronze or above, so please go in and edit and update this article to keep it fresh and relevant.

The ListView is a sort of hybrid between a DataGrid and Repeater that combines the free form templating of the Repeater with the editing features of the data grid. It looks interesting because it basically allows you much more control over the layout than a DataGrid does while still giving you many of the more advanced features of the data grid. The ListView doesn't support paging natively, so the DataPager serves as an external control to provide paging features. The advantage of a separate control is that it gives you much more control about what the pager looks like and where it can be placed on the page - anywhere basically. The Pager is essentially an extender control that extends the ListView with paging capabilities.

 <asp:ListView ID="ListView1" runat="server" ItemPlaceholderID="Placeholder1" DataSourceID="LinqDataSource1"
                <table runat="server" id="table1">
                    <tr runat="server" id="Placeholder1">
                <asp:LinkButton runat="server" ID="Link1" Text="Edit"></asp:LinkButton>
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="DataClassesDataContext"
        <asp:DataPager runat="server" ID="DataPager1" PageSize="2" PagedControlID="ListView1">
                <asp:NumericPagerField />


Article Link 


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

ASP.NET Community
United States United States
The ASP.NET Wiki was started by Scott Hanselman in February of 2008. The idea is that folks spend a lot of time trolling the blogs, googlinglive-searching for answers to common "How To" questions. There's piles of fantastic community-created and MSFT-created content out there, but if it's not found by a search engine and the right combination of keywords, it's often lost.

The ASP.NET Wiki articles moved to CodeProject in October 2013 and will live on, loved, protected and updated by the community.
Group type: Collaborative Group

741 members

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.161021.1 | Last Updated 11 Oct 2013
Article Copyright 2013 by ASP.NET Community
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid