el_buck0 el_buck0 - 1 year ago 60
C# Question

strange behaviour when submitting form 2nd time

I am using kendo window and Ajax.BeginForm() within a partial view bound to a model.
The window is rendered directly into the stream.

@using (Ajax.BeginForm("PostReview", "Review", new AjaxOptions
HttpMethod = "Post",
InsertionMode = InsertionMode.Replace,
OnSuccess = "onSuccessreviewOrderDialogForm",
}, new
@id = "reviewOrderDialogForm"

@Html.HiddenFor(m => m.OrderReviewId)

Here is the thing:
After posting the first model, the following posts will always store the previous value (first model) for
Now I know that the HtmlHelpers will always use the values of the post back from the server but in this case I do not see the problem.
After posting the window is beeing closed. After that the new model (with correct values) is beeing passed to the same partial view including the
kendo window
and rendered with the new! model. Debug mode shows correct values for all fields.
But by posting, the value for
remains the old one.
How is that even possible? And why aren't the other fields (not shown here) correct - they are also HtmlHelper fields.


Answer Source

I bet you have some artifacts left over from the previous instance of the window. Can you ensure that your dialog is entirely removed from the dom after you close it. Something like:

if ($("#frmTest")!= null)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download