I am trying to show names and counts in a repeater.
Have two tables here. Votes and Medicines. Votes has the votes and a foreign key (FK_MedicineID) to the Medicine table.
I want to show the medicines with the most votes in a repeater (take the first 3)
It works when i just want to show the FK_MedicineID, but I want to make the join to the Medicinetable and show the MedicineName...
Somehow I don't see how to do this, because I use the select new { ... }; in my query.
THis is my code:
MMDataContext
db = new MMDataContext(strConnection);
var qmed = from vote in db.Votes
group vote by vote.FK_MedicineID into g
orderby g.Count() descending
select new { MedId = g.Key, Count = g.Count() };var medmostvotes = qmed.Take(3);
Repeater1.DataSource = medmostvotes;
Repeater1.DataBind();
In my select new I want to add something like MedName = ....
But don't see how.
Any suggestions?
Thanks