I am trying to figure out if it is possible to have multiple inheritance in a view in ASP.Net MVC. Now I am trying to print a list of records from two different tables from my model in one view. I have the following line at the top of my view:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.CoursePrefix>>"
But I also want to include the course in the table as follows:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.Course>>"
I am not sure how this can be done, any help or suggestions are appreciated.
UPDATE:
Thanks to everyone for your help, I went ahead and created a composite class as follows:
namespace GEApproval.Models { public class Listings: GEApproval.Models.CoursePrefix, GEApproval.Models.ICourse { public List<CoursePrefix> CoursePrefixObjList { get; set; } public List<Course> CourseObjList { get; set; } private GEApprovalDataModel _db;
And, in my opinion, now I have the following line:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.Listings>>"
I'm still a little confused because I still cannot access the properties of the Course object when they are listed in my view, because I only inherit directly from CoursePrefix. I'm not sure what I am missing. Do I need to have a constructor for a composite object? Do I need inheritance and implementation instructions for CoursePrefix and ICourse, respectively, if I already supposedly disclose the properties of each of the shell-list classes?
source share