ASP.net
Awesome
Learn
Forum
Buy
Demos
Sign In
☾
☀
Switch to
Dark
Light
Mode
this site works best with javascript enabled
Ask Question
PopupForm submit after failed submit
Title:
B
I
{code}
?
Hi, after a "failed submit" the Save button is ineffective. What I mean with "failed submit" is, a validation failure happens inside my server and a failure message would be returned to the client and displayed (see below - Error handling). PopupForm: function ShowPopup() { @Url.Awe().PopupFormAction().Name("DataEntry").Url(Url.Action("Create", "DataEntry")).ParameterFunc("CreateParameters").Height(600).Width(820).Modal(false).OkText("Save").CancelText("Cancel").Resizable(true); } ErroHandling: $.ajaxSetup({ error: function (XMLHttpRequest, textStatus, errorThrown) { alert("Error: " + textStatus + ": " + errorThrown); } }); How could I change this? I wanna click at the Save Button again, even though a failure happens before. Thanks in advance, Christoph
Save Changes
Cancel
PDMDSUI
asked at 11 Mar 2014
this happens for an unhandled exception, you can put a try catch in the post action and handle the exception
at 11 Mar 2014
Omu
OK thanks. My solution: - Added a try catch block, handle the exception and return a failure message as json object. - Prevent dialog to close on success .CloseOnSuccess(false) - Handle the response in a success method .Success("OnSuccess") ... function OnSuccess(e) { if (e.success) {$("#DataEntry").dialog("close");} else {alert(e.error);} };
at 12 Mar 2014
PDMDSUI
you can also add it as a model error ModelState.AddModelError(string key, string errorMessage); http://stackoverflow.com/a/5740852/112100
at 12 Mar 2014
Omu
Answers
please
Sign In
to leave an answer
By accessing this site, you agree to store cookies on your device and disclose information in accordance with our
cookie policy
and
privacy policy
.
OK