0

I have a _Partial.cshtml view which is called in a Parent.cshtml view in the following manner:

Parent.cshtml:

@Html.Render("_Partial");

In the _Partial.cshtml view, there is a button which is linked to a form in the following manner:

using (Html.BeginForm("Send", "DetailsController", FormMethod.Get))
{
    <input type="submit" value="submit" />
}

In the DetailsController I have the Send action which looks like this:

    public ActionResult Send(int orderId)
    {
        if (some condition)
        {
            return RedirectToAction(parentAction, parentController, new {orderId});
        }

      return RedirectToAction(action, controller, new {orderId});
    }

The issue I am having is that the ParentActionViewContext is null.

How can I obtain the Parent Controller name of the partial view?

Duvarian
  • 177
  • 3
  • 10

1 Answers1

0

I believe this is used for Parent/Child actions... not view partials. The only time this is not null is when you are in a child action.

Nicholas
  • 3,286
  • 5
  • 27
  • 35