C# ASP.NET MVC Forms Introducing CRUD Applications Reviewing the List Page

Amit Ghosh
Amit Ghosh
8,943 Points

Need help to understand the Index.view error

@model List<Treehouse.FitnessFrog.Models.Entry> . . <div class="pull-right"> <a href="@Url.Action("Edit", new { id = entry.Id })" class="btn btn-warning btn-sm margin-right"> <span class="glyphicon glyphicon-edit"></span><span class="hidden-xs"> Edit</span> </a> <a href="@Url.Action("Delete", new { id = entry.Id })" class="btn btn-danger btn-sm"> <span class="glyphicon glyphicon-trash"></span><span class="hidden-xs"> Delete</span> </a> </div>

I am getting the error in declaring the route values new { id = entry.Id }) Saying cannot assign 'method group' to anonymous type. This gives an error when i try to debug the program setting the breakpoint in Add Action Method {return view}.

Checked stackoverflow they were recommending on adding the model directive, which is already there @model List<Treehouse.FitnessFrog.Models.Entry> also to make sure Entry.Id property is public in entry model. Which is also done.

Can i get some help as to understand why this runtime compilcation error is coming.

Allan Clark
Allan Clark
10,804 Points

could you link to the challenge associated with this question. Also click on 'Markdown Cheatsheet' for help posting formatted code.

1 Answer

Amit Ghosh
Amit Ghosh
8,943 Points

this was due to the microsoft code dom compiler version, updated that to fix the issue