ASP.NET MVC2 - Model Binding multiple data sources on one View page - Options? -
i have 1 view page (myview.aspx) , many data sources bind on page.
lets has books, publishers, comments, etc.
each 1 of has object provides list, list, etc.
in view, optiosn multilple model biding?
i want check see if each 1 empty, , enumerate it. can't check model.count() because wouldn't model made of objects if set page inheriet ?
what options? should load each content area in control/partial view?
or can dump each object viewdata , check count casting in view?
thanks taking @ problem.
have considered using viewmodel contains lists of of different data fields , using populate view?
example:
viewmodel:
public class myviewmodel { list<book> books {get; set;} list<publisher> publishers {get; set;} list<comment> comments {get; set;} //other fields... //constructors... }
then in view check if specific field null prior enumerating through it:
view:
if(model.books.count() != 0) { //enumerate through results here }
Comments
Post a Comment