如何将 RouteValueDictionary 添加到 T4MVC ActionLink
似乎没有扩展方法可以包含一些通常我希望进入查询字符串的任意路由值。
旧代码:
<%: Html.ActionLink(Model.ParentMessage.Category.Text, "index", null, new { category = Model.ParentMessage.CategoryID }, new { })%>
我想将其更改为此,但它将类别作为 HTML 属性。
<%: Html.ActionLink(Model.ParentMessage.Category.Text, MVC.Feedback.Index(), new { category = Model.ParentMessage.CategoryID })%>
在我编写自己的扩展方法之前,仅检查这一点是不可能的,因为肯定这已经被考虑在内?
There seems to be no extension method to include some arbitrary route values that normally I would expect to go into the querystring.
Old code:
<%: Html.ActionLink(Model.ParentMessage.Category.Text, "index", null, new { category = Model.ParentMessage.CategoryID }, new { })%>
I want to change it to this but it takes the category as an HTML attribute.
<%: Html.ActionLink(Model.ParentMessage.Category.Text, MVC.Feedback.Index(), new { category = Model.ParentMessage.CategoryID })%>
Just checking this isn't already possible before I write my own extension method as surely this was already accounted for?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,它就在那里! :) 请参阅文档 (http://mvccontrib.codeplex.com/wikipage?title=T4MVC_doc< /a>)。查找“添加其他路由参数”。
例如:
或者
Yes, it's there! :) See the doc (http://mvccontrib.codeplex.com/wikipage?title=T4MVC_doc). Look for "Adding additional route parameters".
e.g. either:
or