ASP.NET MVC 4, List Course and Language on same View -


i have simple view, without model in it, want display course on course table , language list languages table.

both table not connected each other, in webform using usercontrol result, in mvc not able result want.

any tutorial great.

regards

  • you should query database retrieve 2 collections.
  • create view model object 2 properties hold 2 collections.
  • then pass object view.
  • in view create html table each collections

a viewmodel class have need in view. in case:

public class myviewmodel{    public list<course> mycourses { get; set;}    public list<language> mylanguages { get; set;} }  

in controller action, can call database logic have retrieve collections, instanciate viewmodel, , pass view.


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -