Shopping Cart(0)
|
Lightbox(0)
|
Login
ASP.Net Primer
Submit an Article
Web Hosting
Stock Photos
Repeater and the PagedDataSource
ASP.Net Primer
Web Application Vs Web Site
Web Site Techniques
Interface Techniques
DataSource Overview
Create a DAL for an ODS
Advanced ObjectDataSource
Adventures in .net Paging
Add Paging to a DataList
Repeater PagedDataSource
Advanced ObjectDataSource
SQL Server Primer
Apply
Common Functions
Cast
Convert
Date Functions
Null Functions
Lower & Upper
Except
Intersect
Pivot
RowNumber & Rank
Software Primer
XML Overview
Name Your Site
Syndicate With RSS
Web Design - Get a Spine!
Security: What Hackers Do
Intro To PHP
CGI: What & How?
Web Marketing
Start a Traffic Virus
Repeater
and the PagedDataSource
ASP.Net tutorial by Barbie Hocking ©2010
Next Page
The ASP.Net Repeater provides complete flexibility of a data bound layout. One drawback of Repeaters is that they don't contain automated paging functionality. This Visual Studio tutorial contains instructions on how to implement paging within a Repeater.
This lesson uses the PagedDataSource class which encapsulates the paging-related properties of a data-bound control. Since the entire SQL resultset is maintained in cache, this method is not suitable for large resultsets.
This example uses a Repeater, but the same technique can be used for any data bound control.
For large resultsets, you can use the technique defined in the
Add Paging to a DataList
tutorial. That lesson defines how to define SQL functionality that returns only the rows that will display on a page.
C# Sample Code
1.
Create a web from and drag a repeater onto it. Do not assign a DataSource. It will be assigned programatically.
2.
Assign the name rptOrderDetails to the Repeater.
Create an ItemDataBound event. This isn't part of the paging functionality. It is used to display only the first occurrence of OrderId for orders sharing the same id.
3.
Create a SqlDataSource. Select a data connection. If you already have a connection string defined in your web.config, select that connection.
4.
Select "Specify a custom SQL statement or stored procedure" in the "Configure the Select Statement" dialog.
5.
Enter the SQL statement :
"select * from dbo.[Order Details Extended] order by OrderID"
6.
Select "Test Query" to validate the query. If the results display, select "Finish".
Next Page
Powered by
www.ezjooz.com