I am trying to only pull certain items into a list trying this
var newsposts = selection.OrderByDescending(x => x.CreateDate).Where(x => x.GetPropertyValue<string>("newType2") == @PageTheme).ToList();
Page loads but nothing is brought back. I have 1 news page that I want all content to display on but if you are in a certain page theme only to bring back the news for that page. I am using an IF statement below to do this but the pagnation doesn't work.
Hi I will try this but I think it is not possible as i am using a multi selection list when creating the news article to allow the items to appear on multiple pages.
Razor Where()
Hello,
I am trying to only pull certain items into a list trying this
Page loads but nothing is brought back. I have 1 news page that I want all content to display on but if you are in a certain page theme only to bring back the news for that page. I am using an IF statement below to do this but the pagnation doesn't work.
Any ideas?
Hi Michael,
there might be other things inside the view but from that bit of code, i think you can remove the
@
symbol from@PageTheme
so it looks like:
as you are already inside a code block in razor you don't need the @ symbol to identify the variable.
Hi I will try this but I think it is not possible as i am using a multi selection list when creating the news article to allow the items to appear on multiple pages.
Also I think is better change order of statements, first where and after order, of course PageTheme should be string
is working on a reply...