Is it posible to set the layout to null in action filter? For example
public ActionResult SomeAction()
{
return PartialView();
}
I want to render some action with
@Html.Action("someaction")
it works for now.
But i want to use this action in 2 modes : like child and like master for different situations. I can set Layout to null in view for this
view:
@{
if(condtition)
{
Layout = null;
}
}
But i want to find more elegant way :)
Like:
action without partial
public ActionResult SomeAction()
{
return View();
}
and in filter set the layout to null if action is child
public class LayoutFilter : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if(filterContext.IsChildAction)
{
//set the layout to NULL here!
}
}
}
It is posible? Any ideas?