[英]MVC & Url.Action
Hi I am having difficulties using Url.Action
method, please see my code below, what am I doing wrong....?嗨,我在使用
Url.Action
方法时遇到困难,请参阅下面的代码,我做错了什么......? (I'm using MVC Razor) (我正在使用 MVC Razor)
<a href='<%: @Url.Action("Edit", "Student",
new { id = item.DealPostID }) %>'>Hello </a>
Student
is my StudentController
and Edit
is ActionResult
method. Student
是我的StudentController
, Edit
是ActionResult
方法。
Remove <%: %>
from your Razor view.从 Razor 视图中删除
<%: %>
。 Those are WebForms tags.这些是 WebForms 标签。
<a href='@Url.Action("Edit", "Student",
new { id = item.DealPostID })'>Hello </a>
Try this:试试这个:
@Html.ActionLink("Hello", "Edit", "Student", new { id = item.DealPostID }, null)
That should work out for you.那应该适合你。
<a href='@Url.Action("Index", "Cliente", "Home")'>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.