Html-Code.ActionLink Wert von ViewBag

In ASP MVC C# ich geputtet eine Liste(Autos) im ViewBag.Autos, nun möchte ich einen actionlink mit dem Titel jedes Autos, wie dieses:

@if (ViewBag.cars != null)
{
    foreach (var car in ViewBag.cars)
    {
         <h4>@Html.ActionLink(@car.title, "Detail", "Cars", new { id = @car.id }, new { @class = "more markered" })</h4>
    }
}

Den Fehler bekomme ich wenn ich @Auto.Titel oder nur Auto.Titel als Wert, ich bekomme diese Fehlermeldung:

CS1973: 'System.Web.Mvc.HtmlHelper<AutoProject.Models.CarDetails>' has no applicable method named 'ActionLink' but appears to have an extension method by that name.
 Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.

Was soll ich füllen Sie als ersten parameter der Actionlink?

InformationsquelleAutor francisMi | 2014-01-09

Schreibe einen Kommentar