Why is always MasterName blank in OnActionExecuted?
Posted
by devzero
on Stack Overflow
See other posts from Stack Overflow
or by devzero
Published on 2010-04-23T12:03:47Z
Indexed on
2010/04/23
12:13 UTC
Read the original article
Hit count: 241
c#
|asp.net-mvc-2
I'm trying to get the master page changed for all my aspx pages. For some reason I'm unable to detect when this function is called for a ascx page instead. Any help in correting this would be appreciated.
protected override void OnActionExecuted(ActionExecutedContext filterContext)
{
var action = filterContext.Result as ViewResult;
if (action != null && action.MasterName != "" && Request.IsAjaxRequest())
{
action.MasterName = "Ajax";
}
base.OnActionExecuted(filterContext);
}
© Stack Overflow or respective owner