title: ASP.Net MVC multiple inheritance in a View
body: <p>I'm trying to figure out if its possible to have multiple inheritance in a view in ASP.Net MVC.  Right now I'm trying to print out a list of entries from two different tables from my model in a single View.  I have the following line at the top of my view:</p>
  
  <pre><code>Inherits="System.Web.Mvc.ViewPage&lt;List&lt;GEApproval.Models.CoursePrefix&gt;&gt;"
  </code></pre>
  
  <p>But I also want to include the table Course as follows:</p>
  
  <pre><code>Inherits="System.Web.Mvc.ViewPage&lt;List&lt;GEApproval.Models.Course&gt;&gt;"
  </code></pre>
  
  <p>I'm not sure how this can be accomplished, any help or suggestions are appreciated.</p>
  
  <p>UPDATE:</p>
  
  <p>Thank you all for your help, I went ahead and created a composite class as follows:</p>
  
  <pre><code>    namespace GEApproval.Models
  {
      public class Listings: GEApproval.Models.CoursePrefix, GEApproval.Models.ICourse
      {
          public List&lt;CoursePrefix&gt; CoursePrefixObjList { get; set; }
          public List&lt;Course&gt; CourseObjList { get; set; }
          private GEApprovalDataModel _db;
  
          //Constructor
          public Listings()
          {
              _db = new GEApprovalDataModel();
          }
  
          //Generate a list of all courses associated with the prefix and place in ViewData model
          public void listCourses(ViewDataDictionary viewData, int prefixID)
          {
              var test = _db.CoursePrefix.Include("Course").First(cp =&gt; cp.id == 1);
              //Show total courses for this prefix
              viewData.Model = test.Course.ToList();
              viewData["prefix"] = test.Prefix;
              viewData["courseCount"] = test.Course.Count;
              int courseCount = test.Course.Count();//Test
          }
  
      }
  }
  </code></pre>
  
  <p>And in my view, I now have the following line:</p>
  
  <pre><code>Inherits="System.Web.Mvc.ViewPage&lt;List&lt;GEApproval.Models.Listings&gt;&gt;"
  </code></pre>
  
  <p>I'm still a little confused because I still cannot access the properties of the Course object when listing them in my view, because I'm only inheriting directly from CoursePrefix.  I'm not sure what I'm missing.  Do I need to have a constructor for the composite object? Do I need the inherit and implementation statements for CoursePrefix and ICourse respectively if I'm already, supposedly, exposing the properties of each within the Listings wrapper class??</p>