Generate urls using T4MVC in a controller action
Asked Answered
H

1

10

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?

Hhour answered 19/2, 2012 at 16:38 Comment(0)
Y
13

Yes!

string url = Url.Action(MVC.Views.Index());

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

Yusem answered 19/2, 2012 at 16:42 Comment(1)
Oops, This is not working in Controller and it just working in Razor :-(Fulk

© 2022 - 2024 — McMap. All rights reserved.