简体   繁体   中英

Navigate Through records in 3-tier application

I need your help. How to navigate through records in 3-tire application of asp.net with c#? Suppose like i am returning record set from dataacess layer to my UI layer then what is the better way to navigate it like next,previous,first and last record.

Thanks in Advance

You should adopt a record pagination strategy for data access, whereby data is retrieved in pages of N rows at a time, and allow data from a query to be retrieved from an arbitrary offset (ie You shouldn't hold database resources such as a connections or cursors open while the user decides what next to do).

The client itself will need to maintain this state (ie the current page the user is viewing is stored on browser), such as which record / page the user is currently browsing.

Each time the user navigates to a new page, you will need to fetch appropriate batch of data from the, remembering any filters that are applicable (Page Number, Page Size and Start Record are common models here).

You haven't mentioned which database you are using, but most RDBMS systems have pagination friendly functions such as OFFSET and LIMIT (and even Sql Server 2012 now has OFFSET / FETCH NEXT N ROWS ). Linq based ORMs then expose these as easy to use functions for paging as Skip() and Take() respectively.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM