Results 1 to 4 of 4

Thread: [RESOLVED] Hlep passing the other model to a partiall view

Threaded View

  1. #1

    Thread Starter
    Fanatic Member VBKNIGHT's Avatar
    Join Date
    Oct 2000
    Location
    Port25
    Posts
    619

    Resolved [RESOLVED] Hlep passing the other model to a partiall view

    ASP.NET Framework 4.0 MVC C#

    I have created a 2 model in a class and pass it to view and the other to a partial view. But the partial always return exception.

    it is something like this:

    Code:
    //my class
     public class myIndexData
    {
            //display record details
            public stp_Student_Result StudentDetail { get; set; }
            //display record sublist display (note: all of my table is joined/related dynamically/only in my stored procedure)
            public List<stp_Courses_Result> CourseLists { get; set; }
    }
    
    
    //in my controller:
      var myIndexData= new myIndexData()
                    {
                        StudentDetail =  Db.stp_Student(id).Single(),
                        CourseLists = Db.stp_Courses(id).ToList()
    
                    };
    
       return View(myIndexData);
    
    //in my view
    @model SWB2MVC.Models.myIndexData
    
    @Model.StudentDetail.Name // this works displaying the main record model! 
    
    @Html.Partial("_partialpage", Model.CourseLists) = this one throw exceptions! 
    
    
    //in my partial view
    @model IList<stp_Courses_Result>
    pls give advice. TIA
    Last edited by VBKNIGHT; May 29th, 2013 at 11:30 PM.

    If a post has helped you then Please Rate it!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width