SiberianGuy
SiberianGuy

Reputation: 25292

Do not apply _ViewStart to child actions

My _ViewStart sets Layout property. It worked fine untill I started to use child actions - in this case Layout is applied both for main action and for child. Is there any way to deny applying _ViewStart (or at least Layout) to child actions?

Upvotes: 3

Views: 397

Answers (1)

Tejs
Tejs

Reputation: 41236

It sounds like you need to make sure you child action renders a PartialView:

AKA

 @Html.Action("YourActionMethodName");

The code would look like so:

 public ActionResult YourActionMethodName()
 {
      return PartialView();
 }

Upvotes: 2

Related Questions