1

Possible Duplicate:
Rendering views without master page in MVC3

I have one view in my project (a bill) and I would like this view to not be shown in a master view wrapper - rather I just want the HTML within the view to be shown. What is the correct way to make a view ignore loading a master layout?

Community
  • 1
  • 1
NickP
  • 1,354
  • 1
  • 21
  • 51

1 Answers1

6

What is the correct way to make a view ignore loading a master layout?

You could put the following at the top of your view:

@{ 
    Layout = null;
}

Or from within the controller action that is supposed to serve this view return a PartialView instead of a View:

public ActionResuilt SomeAction()
{
    return PartialView("_SomePartialView");
}

Or even return a view and specify a null Layout:

public ActionResuilt SomeAction()
{
    return View("SomeView", null, null);
}
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928