This article is a note on the use of the AspNetPager control!
For the AspNetPager control, you can view the Yang Tao homepage. This is an open custom ASP. the. NET Control supports various custom data paging methods, which are easy to use and powerful. You can use this control during website development to save a lot of unnecessary trouble.
Download this page: AspNetPager745DLL.zip
Next, let's take a look at how to pass the paging data to the control through Entity Framework on the page to implement real paging.
Page front-end code:
'Title = ''' target = "_ self"> 'target = "_ self"> no related content!
Page background code:
Page_Load( (! ( context = = context.infolist.Where(n => n.delstate != BindData( pageSize, ( context = infoList = info info.delstate != ===== AspNetPager1_PageChanged(
Easy to use! First, you need to tell AspNetPager how many records the data to be bound to, and then retrieve the paging data through the AspNetPager_PageChanged event. AspNetPager can customize different paging methods, or pass paging parameters through URLs. For details about how to use it, refer to the help documentation on Yang Tao's homepage. The following code shows how to get Entity Framework to return the paging query result.
IQueryable<T> ToPagedQuery<T>( IQueryable<T> query, pageSize, query.Skip(pageSize * (pageNumber - IEnumerable<T> ToPagedQuery<T>( IEnumerable<T> query, pageSize, query.Skip(pageSize * (pageNumber -
It is also very simple, that is, the Skip () method and the Take () method are used to obtain the data after pagination. Entity Framework knows how to obtain the correct data records from the database. The IQueryableExtensions class in the code above contains two methods: IQueryable generic extension methods and IEnumable generic extension methods.
Then, you can enjoy powerful data paging on the page!