开发者

Determine if Call to Action is from a View

Is there a way to determine if a call to a controllers action is from a view using the Html.Re开发者_开发问答nderAction function.

This is similar to Request.IsAjaxRequest. If the call comes from a view I would like to just render a partial view rather than the the full view with master page.

BTW Render partial is not a viable solution as the action fetches additional data


Using the ControllerContext.IsChildAction has the given effect. this way I can provide the same HTML using a child action and a ajax request (for fallback on non javascript users)

        if (Request.IsAjaxRequest() || ControllerContext.IsChildAction)
            return PartialView("ViewName", results);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜