How to filter my datagridview by the value of my label.text on click event? That value is from my linq query:
dataSet.Tables[0].AsEnumerable().Where(c => c.Field<int>('ageColumn') > 3 && c.Field<int>('ageColumn') < 5).Count();
Let’s just say the above query gives me 12 (label.text = 12), now when I click ’12’, I want my datagridview to ONLY show those 12 rows that meet my above query.
Do you need it to be dynamic? Perhaps store the query itself as a lambda in the Tag property of your label:
… then re-evaluate your query when the label is clicked:
I don’t know if this would work, but at least it would let you ‘attach’ a where-clause to various lables.
I’d also recommend taking a look at Bindable LINQ so the results of your queries can be bound to. Very cool stuff.