mercredi 25 février 2015

Getting error with viewbag list

Hi guys I am trying to convert a List to List and pass with Viewbag, but it just showing the last number.


For example:



string strIDs = "15,20,30,44";
List<int> IDs = strIDs.Split(',').Select(s => int.Parse(s)).ToList();

foreach (int myNumbers in IDs)
{
ViewBag.Numeros = myNumbers ;
}


View:



@ViewBag.Numeros


Which the result is just showing the number 44. So If you guys can help me please, thanks Fernando.


Aucun commentaire:

Enregistrer un commentaire