Reputation: 1312
Hi I am having difficulties using Url.Action
method, please see my code below, what am I doing wrong....? (I'm using MVC Razor)
<a href='<%: @Url.Action("Edit", "Student",
new { id = item.DealPostID }) %>'>Hello </a>
Student
is my StudentController
and Edit
is ActionResult
method.
Upvotes: 9
Views: 71649
Reputation: 46008
Remove <%: %>
from your Razor view. Those are WebForms tags.
<a href='@Url.Action("Edit", "Student",
new { id = item.DealPostID })'>Hello </a>
Upvotes: 24
Reputation: 2198
Try this:
@Html.ActionLink("Hello", "Edit", "Student", new { id = item.DealPostID }, null)
That should work out for you.
Upvotes: 7