ASP.NET MVC 3: How to call two model class in to a single view(.cshtml)
This is the sample code for load two model class in to a single view in asp.net mvc 3. To do this you just create a composite class with both objects as its properties:
In Model
initialize the class and apply to view.
In View
@model urNamespace.MoviePersonModel
//and access its properties: @Model.PersonModel
Please share this post with your friends. If it's useful to you. Thanks!.
This is the sample code for load two model class in to a single view in asp.net mvc 3. To do this you just create a composite class with both objects as its properties:
In Model
public class MoviePersonModel { public MvcContrib.Pagination.IPagination<MvcContrib.Samples.UI.Models.Person> Person{ get; set; } public MvcContrib.Pagination.IPagination<MvcContrib.Samples.UI.Models.Movie> Movie{ get; set; } }
initialize the class and apply to view.
In View
@model urNamespace.MoviePersonModel
//and access its properties: @Model.PersonModel
Please share this post with your friends. If it's useful to you. Thanks!.
0 comments:
Post a Comment
Share your thoughts here...