Paging in ASP.NET using jTemplate, jQuery & JSON

Abstract: This article demonstrates how to apply paging in jTemplate in ASP.NET using jQuery and JSON.

This article demonstrates how to apply paging in ASP.NET using jTemplate, jQuery and JSON. When working with a large dataset, it’s not a good idea to show all the records at once as it leads to performance issues in your website if a large number of visitors visit your site. Thus paging helps improve performance as the records are processed on demand.

Step 1: Open VS 2010. Create a new ASP.NET project using File > Web Site. Give the website a name and press the OK button. In this website, I have created a Message and GridDataSet classes as shown below.

publicclassMessage

{

publiclong ID { get; set; }

publicstring Subject { get; set; }

publicString Body { get; set; }

publicDateTime Date { get; set; }

}

publicclassGridDataSet

{

publicint PageNumber { get; set; }

publicint TotalRecords { get; set; }

publicint PageSize { get; set; }

publicList<Message> MessageList { get; set; }

}

Step 2: I have created Messages() function which will return a list of Messages to the FetchData function. The FetchData function will return GridDataSet List.

Aamir Hasan is a Sr. Software Engineer and Technical Lead in a US based firm, having five years of experiences working in Software Design, Web Development, Consultancy and Training, using SQL Server and .NET Framework. He is an SEO professional too. He is capable of coordinating off-shore high level web development projects. Aamir also blogs at www.aspxtutorial.com and www.dotnetplace.com

Feedback - Leave us some adulation, criticism and everything in between!