且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在控制器动作中使用T4MVC生成网址

更新时间:2023-02-13 10:09:03

是!

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().

有关在控制器操作中使用T4MVC的更多说明,请参见:

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