c# - An expression tree may not contain a dynamic operator -


i'm trying join 2 tables. user , scoreboard

viewmodels>scoreboardvm.cs

public class scoreboardvm { public ienumerable<dynamic> scoreboards { get; set; } } 

controller

var db = new gamedbdatacontext(); var userlist = (from s in db.scoreboards                join u in db.users on s.user equals u.userid                select new { username = u.username }).take(5);  var viewmodel = new scoreboardvm(); viewmodel.scoreboards = userlist;  return view(viewmodel); 

view

@model project.viewmodels.scoreboardvm     @foreach (var item in model.scoreboards) {     @html.displayfor(model => item.username) } 

the last line returns error "an expression tree may not contain dynamic operator" , i'm not sure means.

the error aree getting because public ienumerable<dynamic> scoreboards dynamic , @foreach (var item in model.scoreboards) dynamic not supported lambda expression


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -