0

How to I get the grouped data to show up on my view? It wants to recieve a IEnumerable of the model but I'm passing grouped data.

I'm returning this to the view in my controller:

var slb = (from s in db.Tbl_Slb
          group s by s.Tbl_Docent.Docent_Code into d
          select d)

This is the model

public partial class Tbl_Slb
    {
        public Tbl_Slb()
        {
            this.Tbl_Opmerking = new HashSet<Tbl_Opmerking>();
        }

        public System.DateTime Slb_Van { get; set; }
        public Nullable<System.DateTime> Slb_Tot { get; set; }
        public string Student_Nummer { get; set; }
        public int Docent_Code { get; set; }
        public int Slb_Code { get; set; }

        public virtual Tbl_Docent Tbl_Docent { get; set; }
        public virtual ICollection<Tbl_Opmerking> Tbl_Opmerking { get; set; }
        public virtual Tbl_Student Tbl_Student { get; set; }
    }
R4VANG3R
  • 415
  • 1
  • 4
  • 11
  • then shouldn't your view be taking in a type of IEnumerable and dont really want to stick my nose in but Tbl_Slb, Slb_Van, Slb_Tot is going to be a nightmare for anyone else that may have to work on that code, and try like hell to work out what all the abbreviations stand for – davethecoder Mar 30 '13 at 00:37
  • Actually those aren't abbreviations, they're dutch. And yes the view takes an IEnumerable – R4VANG3R Mar 30 '13 at 10:21
  • if your query returns results, and the problem is with your view, then maybe you would be better showing the view too so we can see the whole process? – davethecoder Mar 30 '13 at 12:28
  • the query does return results but it returns IGroupings instead of IEnumerables. I want to know how to interpret those on my view. The View is nothing special mostly default. – R4VANG3R Mar 30 '13 at 12:51
  • maybe this is a related question posted on SO http://stackoverflow.com/questions/10461882/c-sharp-linqs-groupedenumerable-usages – davethecoder Mar 30 '13 at 15:09

0 Answers0