Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,810 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