How to get pages data based on categories.

Vote:
 

I created five categories(ALL,Breakfast,Pizza,Lunch,Dinner). in home page i am displaying these categories as a navigation And for dispalying data in home page based on categories created one page type for six pages(page1,page2,Page3,Page4,Page5,Page6). Based on categories i want to display these six pages data. If i click on one All category i want all 6 pages data, if i click on Breakfast i want page2,page3 and page5 data only and click on ramaing categories same like different pages data only. I didn't understand how to gegt these pages based on categories. Can any one help me programmatically. 

Thanks,

Uday

#178324
Edited, May 08, 2017 20:03
Vote:
 

If it's a smaller amount of pages it's probably easiest to work with the full list of pages in memory and filter based on the Categories-property using Linq.

An option would be to add a querystring to each navigation item. If the querystring value is the CategoryId int you don't have to look up the Id before filtering.

#178353
May 09, 2017 21:58
Vote:
 

Hi @Pawan,

Another option if you're querying a large quantity of items would be hitting the search index to retrieve this information whether it's Solr or Episerver Find. Click this link to find examples on how to filter content with Episerver Find specifically (the first one is actually a filter on categories). Hope this helps!

#178358
May 09, 2017 22:37
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.