A
A
addd2015-11-18 17:59:58
ASP.NET
addd, 2015-11-18 17:59:58

How to call View without redirect from another controller?

How to call View without a redirect from another controller so that the initial url does not change.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kovalsky, 2015-11-18
@dmitryKovalskiy

The idea poorly fits into the MVC approach. Ideally, you would move this View to the Shared folder. You can do some magic and try to write return View("ControllerName\ViewName")

D
Dmitry Pavlov, 2015-11-18
@dmitry_pavlov

If from layout, then something like:

@Html.Partial("../OtherController/Action", model)
или
@Html.Action("Action", "OtherController", params)

If from a method in the controller, then something like return PartialView(...);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question