Display a view from another controller in ASP.NET MVC

后端 未结 7 1188
孤街浪徒
孤街浪徒 2020-11-29 16:06

Is it possible to display a view from another controller?

Say for example I have a CategoriesController and a Category/NotFound.aspx view.

7条回答
  •  死守一世寂寞
    2020-11-29 16:16

    You can use:

    return View("../Category/NotFound", model);
    

    It was tested in ASP.NET MVC 3, but should also work in ASP.NET MVC 2.

提交回复
热议问题