Hi i need to show a list of data using viewbag.but i am not able to do it.
Please Help me..
I tried this thing:
ICollection list = ne
Use as variable to cast the Viewbag data to your desired class in view.
@{
IEnumerable personlist = ViewBag.data as
IEnumerable;
// You may need to write WebApplication.Models.Person where WebApplication.Models is
the namespace name where the Person class is defined. It is required so that view
can know about the class Person.
}
In view write this
@(personlist.FirstOrDefault().Name)