ASP MVC 3 use different Layouts in different views

后端 未结 3 1425
既然无缘
既然无缘 2020-12-23 21:35

I have an ASP MVC application which needs multiple different layouts. In ASP.NET Web Apps I would have just made separate master pages. How do I do this in ASP MVC 3?

3条回答
  •  离开以前
    2020-12-23 21:53

    You could set the layout dynamically in your controller action:

    public ActionResult Index()
    {
        var viewModel = ...
        return View("Index", "_SomeSpecialLayout", viewModel);
    }
    

提交回复
热议问题