Asp.net Mvc Take Viewbag As List Code Example


Example 1: viewBag as a list


<td>@((ViewBag.data as ICollection<Person>).First().FirstName)</td>

Example 2: viewBag as a list


<ul>
@foreach (var person in ViewBag.data)
{
<li>@person.FirstName</li>
}
</ul>

Comments

Popular posts from this blog

530 Valid Hostname Is Expected When Setting Up IIS 10 For Multiple Sites

C Perror Example

Converting A String To Int In Groovy