MVC ActionLink 如何指定文本、actionname、控制器和 htmlattributes
我一直在尝试做一个像这样的actionlink:
<li>@Html.ActionLink("Home", "Index", "Invoice", new { id = "homelink" })</li>
所以我拥有的是linkText,一个actionname,一个控制器名称和一个链接的id。
然而,没有与此匹配的签名。最接近的一个具有控制器名称和 html 属性之间的路由值。不过,我没有任何需要放入其中的路线值。
有人可以告诉我如何最好地解决这个问题吗?
I have been trying to do an actionlink like:
<li>@Html.ActionLink("Home", "Index", "Invoice", new { id = "homelink" })</li>
So what I have is linkText, an actionname, a controller name and an id for the link.
However there is no signature that matches this. The closest one has routevalues between the controller name and the htmlattributes. I don't have any routevalues I need to put in there though.
Can someone please tell me how to best get around this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将路由值设置为
null
就可以了!Set route values to
null
and your're good to go!描述
假设我明白您的要求,该
示例
更多信息
Description
Assuming i understand what you are asking for, there is an overload for that
Sample
More Information