I've created a custom usercontrol to get some of the most recent blogposts, but for some reason I keep getting no results from linq. Here's the method that is supposed to get the blogposts:
private IEnumerable<BlogPost> getBlogItems() { myContext = new Outpost11DataContext(); var result = (from p in myContext.BlogPosts orderby p.CreateDate descending select p).Take(NumberOfItems); return result; }
I have a similar method for NewsItems, which does return the right content.
At the moment I have 2 test blogposts that are published. I made sure the document type for both posts are 'BlogPost'. I created the datacontext code from the document types.
Problem solved (sortof). I was not getting any results in my development environment, but after quickly testing it on the live server, everything turned out to be working ok.
linq result always 0 for BlogPosts
I've created a custom usercontrol to get some of the most recent blogposts, but for some reason I keep getting no results from linq.
Here's the method that is supposed to get the blogposts:
I have a similar method for NewsItems, which does return the right content.
At the moment I have 2 test blogposts that are published. I made sure the document type for both posts are 'BlogPost'. I created the datacontext code from the document types.
And I'm using Blog4Umbraco.
Can anyone point me in the right direction?
Problem solved (sortof). I was not getting any results in my development environment, but after quickly testing it on the live server, everything turned out to be working ok.
Most likely cause is there was no items in the XML cache with the alias of the document type.
is working on a reply...