-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: LovedJohnySmith
Message 2 in Discussion

Hi Neeraj,   Good Day    
The ASP.NET DataGrid exposes a wonderful capability: data paging support. When 
paging is enabled in the DataGrid, a fixed number of records is shown at a 
time. Additionally, paging UI is also shown at the bottom of the DataGrid for 
navigating through the records. The paging UI allows you to navigate backwards 
and forwards through displayed data, displaying a fixed number of records at a 
time. 
There's one slight wrinkle. Paging with the DataGrid requires all of the data 
to be bound to the grid. For example, your data layer will need to return all 
of the data and then the DataGrid will filter all the displayed records based 
on the current page. If 20,000 records are returned when you're paging through 
the DataGrid, 19,975 records would be discarded on each request (assuming a 
page size of 25). As the number of records grows, the performance of the 
application will suffer as more and more data must be sent on each request. 
One good approach to writing better paging code is to use stored procedures. 
see the following Stored Procedure.,CREATE PROCEDURE northwind_OrdersPaged (    
 @PageIndex int,      @PageSize int ) AS BEGIN DECLARE @PageLowerBound int 
DECLARE @PageUpperBound int DECLARE @RowsToReturn int  -- First set the 
rowcount SET @RowsToReturn = @PageSize * (@PageIndex + 1) SET ROWCOUNT 
@RowsToReturn  -- Set the page bounds SET @PageLowerBound = @PageSize * 
@PageIndex SET @PageUpperBound = @PageLowerBound + @PageSize + 1  -- Create a 
temp table to store the select results CREATE TABLE #PageIndex  (     IndexId 
int IDENTITY (1, 1) NOT NULL,     OrderID int )  -- Insert into the temp table 
INSERT INTO #PageIndex (OrderID) SELECT      OrderID FROM      Orders ORDER BY  
    OrderID DESC  -- Return total count SELECT COUNT(OrderID) FROM Orders  -- 
Return paged results SELECT      O.* FROM      Orders O,     #PageIndex 
PageIndex WHERE      O.OrderID = PageIndex.OrderID AND     PageIndex.IndexID > 
@PageLowerBound AND     PageIndex.IndexID < @PageUpperBound ORDER BY      
PageIndex.IndexID  END I hope, this may help u, pls lemmi noe u r 
commentsRegards,Smith 

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to