带有 id 属性的 Ajax.Actionlink 输出
I'm using the Ajax.Actionlink
from the MVC framework and everything works fine with my targets and partial views. However I've seen that the html output doesn't add the "id" attribute to the resulting <a href=""></a>
tag.
Is there any way how I can add it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试其中一种重载,例如这个:
然后您可以指定htmlAttributes 参数中的 id,例如
Try one of the overloads, like this one:
Then you can specify the id in the htmlAttributes parameter, e.g.
您需要在对象 htmlAttributes 参数中使用htmlAttributes 来填充它,该属性也可在其多个构造函数中使用。
new { id = "myId" }
,该参数在其多个构造函数中可用。或者您可以使用 IDictionaryYou need to use
new { id = "myId" }
in the object htmlAttributes parameter, available in several of its constructors. Or you can fill it using theIDictionary<string, string>
htmlAttributes also available in several of its constructors.我相信您正在寻找 RouteValues 参数。
I believe you're looking for the routeValues parameter.