1

In an MVC project I have a number of views that can be displayed in two "modes", where a different layout file is used for each mode.

To achieve this, I am setting the layout file using the appropriate Controller.View overload.

public ActionResult Index()
{
    return View("Index", "_IndexLayout");
}

public ActionResult Dialog()
{
    return View("Index", "_DialogLayout");
}

Both of the layout files have a @RenderSection("PageJavascript"), and the views have a @section PageJavaScript.

Here comes the tricky part: ReSharper's solution wide analysis is complaining about this, giving an error of Cannot resolve section 'PageJavaScript'.

Is there an alternative approach to layout switching I can use that will allow ReSharper to know that I am using a layout file that contains this section?

Richard Ev
  • 52,939
  • 59
  • 191
  • 278
  • 1
    Could you not default it to the most common one, then set it to the layout specified in the controller when the param is present? – Slicksim Sep 05 '13 at 08:11

0 Answers0