Jonathan Moriarty
Jonathan Moriarty

Reputation: 498

Render Another Controllers View From Within a Controller (Not Partial View)

We are in the process of converting a Ruby on Rails 3.2 App to .NET MVC 4 using C# as the language. Is there a way to render a view from another controller within the current controller in C# similar to the way Rails does.

For example, in Rails, in your current controller you can call:

render :template => 'another_controller/action'

When searching online all I could find were articles/SO questions regarding rendering partial views from a C# controller. Is rendering a full view from another controller considered not best practice?

Upvotes: 0

Views: 180

Answers (1)

Slappywag
Slappywag

Reputation: 1223

You need to call RedirectToAction

Pass it the action name and the controller name, each as a string.

Upvotes: 1

Related Questions