I'm building a page that shows a LINQ query result as a table.
I get the error
Cannot convert lambda expression to type 'string' because it is not a delegate type
at the line with the code
this.articles = from art in this.articles
                where art.category_id == this.categoryId
                select art;
Any ideas how to fix the code below?
namespace WebApplication3 {
    public partial class _Default : System.Web.UI.Page {
        private IQueryable articles;
        protected void Page_Load(object sender, EventArgs e) {
            this.SetupArticleQuery();
            this.UpdateFilter();
        }
        private void SetupArticleQuery() {
            this.articles = from a in KB.Articles
                            join t in KB.Teams on a.primary_team_id equals t.id
                            join cat in KB.Categories on a.category_id equals cat.id
                            join scat in KB.SubCategories on a.subcategory_id equals scat.id
                            join top in KB.Topics on a.topic_id equals top.id
                            select new {
                                a.id,
                                a.title,
                                a.view_count,
                                a.created_at,
                                a.created_by,
                                a.primary_team_id,
                                primary_team_name = t.name,
                                category_id = cat.id,
                                category_name = cat.name,
                                subcategory_id = scat.id,
                                subcategory_name = scat.name,
                                topic_id = top.id,
                                topic_name = top.name
                            };
        }
        private void UpdateFilter() {
            if (this.categoryId > 0) {
                this.articles = from art in this.articles
                                where art.category_id == this.categoryId
                                select art;
            }
        }
}
                I had to add the following to get this error to go away.
using System.Data;
using System.Data.Entity;
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With