Interviews3 answers
In MVC, is it possible to share a view across multiple controllers?
sumank
Posted May 10, 2013, 11:39 AM EDT3 Answers
Yes.Mention the view full path in the View method.
public class UserController : Controller
{
public ActionResult ShowUser()
{
return View();
}
}
public class AccountController : Controller
{
public ActionResult ShowAccount()
{
return View("~/Views/User/ShowUser.cshtml");
}
}
Hamid KhanPosted Oct 10, 2017, 11:08 PM EDT
Yes, It is possible to share a view across multiple controllers by putting a view into the shared folder.
By doing like this, you can automatically make the view available across multiple controllers.
Mahesh AllePosted Mar 31, 2014, 1:10 AM EDT
Yes, put the view in shared folder. This will automatically make view available across multiple controllers.
sumankPosted May 10, 2013, 11:39 AM EDT

