Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Where to find an example of DAL 2 pagination?Where to find an example of DAL 2 pagination?
Previous
 
Next
New Post
6/14/2015 7:52 AM
 

Hi, 

I've recently started learning DAL 2 with DNN 7 to develop my custom module. I've worked little bit with DAL+ APIs before and had used ListView control with datapager for pagination. 

I'm converting my module to use DAL2 so that I can learn it. 

How can I use GetPage and bind ListView with proper pagination in place? 

** I think I posted this question in the wrong category. There is no option to re-assign to a different category so, I've posted this here again.


 
New Post
6/15/2015 7:46 AM
 

Hi Siddharth,

The best way ( I think ) is to use a Linq statement to accomplish this....

var products = repository.Products

                       .Where(p => this.CurrentCategory == null || p.Category == this.CurrentCategory)

                       .OrderBy(p => p.ProductID)

                       .Skip((page -1) * PageSize)

                       .Take(PageSize);

 

for example.

Hope this helps,

Regards,

Geoff

 


      
 
New Post
6/15/2015 9:06 AM
 

Hi Geoff,

Thanks for your advice. I'm particularly looking to learn how to use IRepository<T> that resides under Dotnetnuke.data namesapce. There are two ways to get page:

IPagedList<T> GetPage(int pageIndex, int pageSize); 

IPagedList<T> GetPage<TScopeType>(TScopeType scopeValue, int pageIndex, int pageSize);

I know how to bind the data with a list view control. How can I use this to bind with a data pager control? 

is there any way to use IPagedList  members like pagecount, pageindex, etc. with data pager or other pager control? Or do I just need to read these pagedlist properties and give a prev, next, page numbers on the screen myself?

Thanks

Sid

 
New Post
6/15/2015 1:31 PM
 
you might want to take a look at the new dynamic content creator module that is coming in DNN 8 it makes extensive use of DAL2 and also has a custom pager i.e. a page with the module on it uses this javascript https://github.com/dnnsoftware/Dnn.Pl... to call this service framework method https://github.com/dnnsoftware/Dnn.Pl... which in turn calls the API athttps://github.com/dnnsoftware/Dnn.Pl... . The data is formatted for display via https://github.com/dnnsoftware/Dnn.Pl...

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
6/16/2015 4:30 AM
 

Hi Cathal, 

I've recently started changing my modules to support DNN 7 as I developed it for DNN 6. No doubt, it works for 7 as well but I thought to learn the latest version in the process. 

I'd like to learn this version first instead of just start to learn another new version - DNN 8. 

I'm able to fetch records using new DAL 2 APIs. Its really good as it takes care of the caching as well when working on pagination.

The only thing I don't understand is how to plug this IPagedList members to a pager in my module. Till date I've been using datapager that just takes care of everything behind the scenes. 

Can you please guide me in the right direction?

Thanks

 
Previous
 
Next
HomeHomeGetting StartedGetting StartedNew to DNN Plat...New to DNN Plat...Where to find an example of DAL 2 pagination?Where to find an example of DAL 2 pagination?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out