Sai Prasad Anumolu

Sai Prasad Anumolu

  • NA
  • 196
  • 18.9k

an expression may not contain a dynamic operation in MVC

Aug 2 2014 7:05 AM
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)