1

In a project we use PartialView and View on the same action, depending how it is called (thanks to Request.IsAjaxRequest()). But there are places where we need to render an action on a page (not ajax).

So we use the HTML helper :

Html.RenderAction(Action, Controller, routeValues)

But this kind of call should also return a PartialView and not a View. And since this seems not to be an Ajax call, we can't use the Request.IsAjaxRequest() method to determine how the request has been sent.

I would like to know if there is something that we can use that could determine if the request has been made by a Html.RenderAction call ?

Whoami
  • 334
  • 4
  • 16
  • This not what I'm asking. I know I can make Ajax request, but I don't want to. all my ajax request are done via jQuery on top of normal request... Html.RenderAction is not done via Ajax. – Whoami Apr 05 '12 at 12:46
  • or you can answer your own question and mark it as accepted... – Rafay Apr 05 '12 at 15:00
  • I have to wait some times before I can answer my own question... – Whoami Apr 05 '12 at 16:09

1 Answers1

0

I found the solution by searching through the whole Request / Controller context and finally found the property IsChildAction on the ControllerContext. This indicates if the action has been called via Html.RenderAction or via the URL.

Whoami
  • 334
  • 4
  • 16