A stand-alone common paging control C # source code

Source: Internet
Author: User
Tags bind

Users can easily change the display control and alter the appearance of the paging control itself. For example, in figure I, display controls that collaborate with pagination controls can be replaced with a DataGrid control, with page numbering links and four navigation buttons displayed in two rows.

ASP.net supports three ways to create custom Web controls: User controls, composite controls, and custom controls. The third type of control, the name of the custom control, can easily be misunderstood. In fact, all three of these controls should be considered custom controls. The difference between a composite control and Microsoft's so-called custom control is that the former uses the CreateChildControls () method, and the CreateChildControls () method allows the control to redraw itself based on certain events. For the general pager in this article, we'll use the composite control.

The following UML sequence diagram outlines the general mechanism of a common paging control.

While our goal is to make the universal paging control independent of the controls that represent the data, it is clear that there must be some way for the paging control to access the data. Each control that inherits from the controls class provides a DataBinding event. We register the pager itself as the listener for the DataBinding event, and the pager can learn the data and modify the data. Because all controls inherited from the control class have this databinding event, the pager control achieves the goal of not relying on a particular data representation control--in other words, the pager control can bind to all controls derived from the control class. That is, it can bind to almost all Web controls.

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.