2
Reply

an expression may not contain a dynamic operation in MVC

Sai Prasad Anumolu

Sai Prasad Anumolu

Aug 2 2014 7:05 AM
908
Error in View :
 
Model  Is
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace BorbaneApplication.Model
{
public class Country
{
public string CountryCode { get; set; }
public string CountryName { get; set; }
}
}
 
View is :
@using BorbaneApplication.Model;
@model BorbaneApplication.Model.Country;
@{
ViewBag.Title = "DisplayTable";
}
<h2>DisplayTable</h2>
<div>
<table>
<tr>
<th>Country Code</th>
<th>Country Name</th>
<th>Operations</th>
</tr>
@foreach(var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelitem =>item.CountryCode)
</td>
<td>
@Html.DisplayFor(modelitem=>item.CountryName)
</td>
</tr>
}
</table>
</div>
 
 
 
 

Answers (2)