MVC & Url.Action
Remove <%: %>
from your Razor view. Those are WebForms tags.
<a href='@Url.Action("Edit", "Student",
new { id = item.DealPostID })'>Hello </a>
Try this:
@Html.ActionLink("Hello", "Edit", "Student", new { id = item.DealPostID }, null)
- Argument 1: Link text
- Argument 2: Action name
- Argument 3: Controller name
- Argument 4: Route values
- Argument 5: HtmlAttributes. This is set to null so that it doesn't append "?Length=" to your URL.
That should work out for you.