C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Interview   Jobs   Projects   Offshore Development    
Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Revenue Sharing | Talk to Us |



My Profile

Gifts

Active Members
TodayLast 7 Days more...







Generic Paging for Recordset with Next Back Navigation


Posted Date: 21 Mar 2008    Resource Type: Articles    Category: .NET Framework

Posted By: sreekanth       Member Level: Gold
Rating:     Points: 10



The resource has not been reviewed by Editors yet. Readers are adviced to use their best judgement before accessing this resource.
This resource will be reviewed shortly.
If you think this resource contain inappropriate content, please report to webmaster.


Introduction
I had made implementing one of the paging functionalities an assignment during my free time. I have written this article so that one can draw some idea and make some control out of it. .NET has provided ready to go paging functionality for DataGrid, DataList etc. But when one has to create a dynamic table populated with thousands of records without using any ASP.NET control, then we have the write code manually.



Precondition
Connection string: change the connection string in Web.confiq file as per your configuration.

< add key="DSNConn" value="SERVER=localhost;DATABASE=Northwind;UID=sa;PWD=sa" />

Constant: There is one Constant.cs file. This Constant file is a storage area for constants and settings for pagination.

public class Constant
{
public Constant()
{
//
// TODO: Add constructor logic here
//
}
public const int iShowNoPage = 5;//Show No Of pages....
public static int jIter =iShowNoPage;
public const int jVirtualInc = iShowNoPage;
public const int iInitialRecDisplay = 10;
// How many record you want to display per page..
}

Just make changes to two parameters, one is iShowNoPage = 5/per page (1, 2, 3, 4, 5) and the other is iInitialRecDisplay = 10. The iInitialRecDisplay parameter displays the number of records from the database on the screen.

Implementation
Note: the DropDownList contains three SQL queries which fetch records from three different tables. This is done to show that table 1 can contain 50 records, table 2 can contain 8 records and so on. In our case, total number of records may vary according to the table provided. On the basis of this total number of records, we have calculated the total number of pages mathematically (using Modulus fun). On doing so, one can get the number of pages per screen. For the rest of the logic one can refer the code as it is self explanatory.

Conclusion:
Please let me know if there are any bugs in my paging functionality. I would appreciate any suggestion on this front.





Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: .NET Architecture Details
Previous Resource: Benefits of Framework 2.0
Return to Discussion Resource Index
Post New Resource
Category: .NET Framework


Post resources and earn money!
 
Related Resources



Read TATA Nano reviews.
dotNet Slackers   BizTalk Adaptors    Web Design   Scripts
Are you waiting for engineering entrance result? Watch here for engineering entrance results.
doors in nj

Contact Us    Privacy Policy    Terms Of Use