So, i have a partial view, let-s say:
@model myModel
@{
Layout = null;
}
....
Html.BeginForm("action", "Controller", FormMethodPost)
.....
.....
.....
.....
<input type="submit" value = "Go"/>
}
Inside of this partial view I am rendering a second partial view so this will be:
@model myModel
@{
Layout = null;
}
....
Html.BeginForm("action", "Controller", FormMethodPost)
.....
@{Html.RenderPartial("secondPartial");}
.....
.....
<input type="submit" value = "Go"/>
}
the second partial also submits a form but this time with Ajax like so:
@model myModel
@{
Layout = null;
}
....
Ajax.BeginForm("secondAction", "sameController", new AjaxOption { HttpMethod = "POST", InsertionMode=InsertionMode.Replace, UpdateTargetID = "thisPartialDivId"})
.....
.....
.....
.....
<input type="submit" value = "Go"/>
}
But now, everytime i submit the second partial it submits it's parrent with the rest of the fields null, even doe i specifically told it which action to submit to it just goes up to it's parent and submits that.
Any ideeas? thx :)
P.S. the reason for this: the second view submits a new value for a propperty and then it should add that value to a dropdown list in the parent view. The parent creates the object.
Kinda solved this with adding an AntiForgeryToken but then i got another error because i had 3 of those on that parent view (one on the parent and 1 on each partial). Still looking for a solution here. :)