在控制器动作中使用T4MVC生成网址 [英] Generate urls using T4MVC in a controller action
本文介绍了在控制器动作中使用T4MVC生成网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用t4mvc在我的项目中生成链接.我想在控制器操作中生成url,这可以使用t4mvc吗?
I am using t4mvc to generate links in my project. I would like to generate urls in a controller action, can this be done using t4mvc?
推荐答案
是!
string url = Url.Action(MVC.Views.Index());
例如
..您应该获得与视图中相同的对象集,只需访问MVC
对象并将其传递给Url.Action().
.. for example. You should get the same set of objects you get in your views, just access the MVC
object and pass it to Url.Action().
Some more notes about using T4MVC in a controller action here: http://www.davidferguson.me.uk/Blogs/Post/strongly-typed-actions-views-and-controllers-with-t4mvc
这篇关于在控制器动作中使用T4MVC生成网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文