asp.net mvc 4 - Alternative to sending data to view in List? -


i learning .net mvc , finished first application. @ minute trying send multiple list of data view, each list mulitple fields , populating multiple tables these lists. example have animals table in db, want pull records table , display of them in table in view. have db treatment table , want display records table in separate unrelated table in view

in past have declared list in viewmodel (below) , populated list required, not useful takes 2 fields, value, , text

             public ienumerable<selectlistitem> treatmentlist { get; set; } 

im not sure if have made problem clear. appreciated

thanks

you may consider 2 approaches:

  1. using viewbag store ienumerable, not need put in view model

  2. you may consider use select list

public selectlist treatmentlist { get; set; }


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -