Most Discussed Custom Widget
I'm hoping someone can give me some help with a custom widget I'm developing. I think all I actually need is syntax help.
I'm creating a custom widget to display the most discussed blog posts. That has gone well, and I have the ability to specify a certain number of blog post summaries to show up, ordered by how many comments they have. This is the code I'm using:
int
count =
int
.Parse(_maxNumberPosts);
// this is a public property on the control
var recentPosts = App.WorkWith().BlogPosts().Publihed().OrderByDescending(b => b.Comments.Count).Get().Take(count);
rptblogMostDiscussed.DataSource = recentPosts;
rptblogMostDiscussed.DataBind();
Hi Raymond,
What I can suggest here is adding a DatePicker control (for example) and wiring it up to a property in your code-behind. Then in the query, you can use the selected value from the DatePicker and using a Where clause, before the OrderByDescending command, filter the blog posts by Comment.PublicationDate for all the dates that are after the selected one. Let me know if you have specific questions on the implementation (syntax) for this.
Greetings,