mercredi 28 janvier 2015

How to save number of records in a list to a variable in a view - MVC


Vote count:

0




Let's say I have a Viewmodel that has a list of anotherviewmodel as one of its members: public class aViewModel { public int modelID { get; set; } public List<bViewModel> bViewModels {get; set; } }


I am trying to save the number of records in the bViewModels list to a variable in my view. Here is my code:



@{ int x = model.bViewModels.Count;}


Thanks in advance for the help.



asked 27 secs ago







How to save number of records in a list to a variable in a view - MVC

Aucun commentaire:

Enregistrer un commentaire