I am not very much familiar with razor
view engine. I tried this code.
@for(var item in ViewBag.list)
{
@foreach (var itemvote in ViewBag.listVote)
{
<h1>@Html.ActionLink(@item.Title, "Details", "Report", new { id = item.Id},null)</h1>
}
}
And it shows the following error:
Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper' 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.
my controller class is ReportController
and method is Details
to which it will be submitted.
public ActionResult Details(int id = 0)
{
Report report = Context.Reports.Find(id);
if (report == null)
{
return HttpNotFound();
}
ViewBag.report = report;
return View();
}
I googled and found some link like HTML.ActionLink method
but i am still unable to correct it.
@Html.ActionLink((string)@item.Title, "Details", new { id = item.Id})
this line is my answer.. – Moshiur Rahman May 06 '13 at 11:11