Creating a universal asp.net data paging control

Source: Internet
Author: User

For almost all data representation Web applications, it is one of the main goals to organize the way that data is displayed and to avoid confusing users. It is acceptable to display 20 records per page, but displaying 10,000 records per page can easily cause inconvenience to users. Splitting data into multiple pages is the most common way to solve such problems.

I. Overview

Asp. NET itself provides only one control that supports data paging, the DataGrid paging control, but it is better suited for use in an intranet environment, and the DataGrid paging control does not seem to provide enough functionality to construct a flexible Web application for the Internet environment. One reason is that the DataGrid control has restrictions on where the web designer places the paging control and the appearance of the paging control, for example, the DataGrid control does not allow the paging control to be placed vertically. Another control that has the advantage of paging technology is that Repeater,web developers can use the Repeater control to quickly configure the display of data, but paging functionality needs to be implemented by the developer itself. Data sources are constantly changing and data representation varies, and if you tailor the paging control to these changing conditions, it's obviously a waste of time, and building a common paging control that is not limited to a particular performance control will greatly help save time.

A good generic data control not only provides regular paging functionality, but it also allows you to:

⑴ provides "Home", "prev", "Next", "last Page" pager buttons.

⑵ adjusts its state according to the data display condition, namely has the data sensitivity. If a paging control is set to display 10 records per page, but in fact there are only 9 records, then pagination controls should not be displayed; In the case where the data is divided into multiple pages, the first page, previous page button should not be displayed, the last page "Next", "last" Buttons should not be displayed either.

⑶ cannot rely on a particular data display control.

⑷ has the ability to adapt to a variety of existing and will have data sources.

⑸ should be able to easily configure the display, easily integrated into a variety of applications.

⑹ to remind other controls when paging is ready.

⑺ even inexperienced web designers need to be able to use them without difficulty.

⑻ provides property data about pagination information.

There are already commercial controls on the market that offer the above features, but they are expensive. For many developers, building a generic paging control is the ideal choice.

Figure one shows the running interface of the common paging control in this article, where the control used for display is a repeater control. The paging control consists of two types of parts: Four navigation buttons, and a set of page number links.

Users can easily change the display control and alter the appearance of the paging control itself. For example, a display control that cooperates with a paging control is replaced with a DataGrid control, and the page numbering link and four navigation buttons are displayed in two rows.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.