Pages of DataPager and VSDataPager in

Source: Internet
Author: User

Pages of DataPager and VSDataPager in

The paging function of Microsoft DataPager is very powerful. Do not set database stored procedures. You only need to add a DataPager control and associate it with the control to be paged. A simple setting can have a good paging effect. Of course, the ideal results should be processed at the front-end and back-end.

DataPager display mode in winform:

Styles in webForm are controlled by TemplatePagerField, NextPreviousPagerField, and NumericPagerField.

By setting the cooperation of the preceding controls, you can also achieve the effect of winForm. The most important of the three controls is the TemplatePagerField control.

The following describes how to set the TemplatePagerField control:

  1   <%@ Page language="VB" %>  2   3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  4     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  5   6 <script runat="server">  7   8   Protected Sub TemplatePagerField_OnPagerCommand(ByVal sender As Object, _  9     ByVal e As DataPagerCommandEventArgs) 10  11     ' Check which button raised the event 12     Select Case e.CommandName 13  14       Case "Next" 15         Dim newIndex As Integer = e.Item.Pager.StartRowIndex + e.Item.Pager.PageSize 16         If newIndex <= e.TotalRowCount Then 17           e.NewStartRowIndex = newIndex 18           e.NewMaximumRows = e.Item.Pager.MaximumRows 19         End If 20  21       Case "Previous" 22         e.NewStartRowIndex = e.Item.Pager.StartRowIndex - e.Item.Pager.PageSize 23         e.NewMaximumRows = e.Item.Pager.MaximumRows 24  25       Case "First" 26         e.NewStartRowIndex = 0 27         e.NewMaximumRows = e.Item.Pager.MaximumRows 28  29     End Select 30  31   End Sub 32  33 </script> 34  35 

Reference: https://msdn.microsoft.com/zh-SG/library/system.web.ui.webcontrols.templatepagerfield.pagercommand.aspx

Https://msdn.microsoft.com/zh-cn/library/system.windows.controls.datapager (v = VS.95). aspx

 

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.