Jake Manet
Jake Manet

Reputation: 1252

MVC 4 get data from Parent from Partial View

I have a case like the following: The Parent page looks like:

    @using (Html.BeginForm("Create", "HTML", FormMethod.Post))
    {
    @Html.DropDownListFor(model => model.SelectedObjectId, Model.MajorObjects)
    @Html.Partial("_SelectCase");
    ...
    }

And in the _SelectCase i want to load some data based on the DropDownList selected element. For this i have the _SelectCase like

@using (Html.BeginForm("SelectCase", "HTML", FormMethod.Post))
{
...
}

And the controller like

public ActionResult SelectCase(CustomIdentity currentUser)
        {
         ...
        }

And the question: how may i get the value from the DropDownlist in the SelectCase method from the Controller?

Thanks.

Upvotes: 0

Views: 687

Answers (1)

Hassan
Hassan

Reputation: 54

As far as I know, you can't have a dynamic partial inside a parent. Parent and Partial views are generated after a server side call. The best you can do is make that partial form in the parent and have whatever values you want to change dynamically fetched through an AJAX call.

Upvotes: 2

Related Questions