c# - MVC3 JQuery modal dialog retains content on close and reopen -
i have jquery modal renders partial view when data entered view, , closed (not saved, close dialog) content retained in view. so, next time modal opened, same when closed first time around.
is there way of forcing modal render original partial view or make this? i've not posted partial view content it's simple form fields on.
view
<div id="client-detail-modal" title="add new address"> @html.partial("_address", address) </div>
jquery
$("#client-detail-modal").dialog({ modal: true, autoopen: false, height: 'auto', width: 600, position: ['middle', 20], buttons: { "add address": function () { $(this).dialog("close"); }, cancel: function () { $(this).dialog("close"); } } }); $('#client-detail-modal').css('height', 'auto');
initiator
$("#client-detail-modal").dialog("open");
when render partial view page renders html main dom. jquery dialog takes partial view , shows in dialog. when make changes modify original view. should on dialog open event clear old values or load defaults , on dialog close event save new values. way can reuse same dialog many times.
http://api.jqueryui.com/dialog/#method-open http://api.jqueryui.com/dialog/#method-close
look @ example , view source http://jqueryui.com/dialog/#modal-form on close event remove old data , clear errors
close: function() { allfields.val( "" ).removeclass( "ui-state-error" ); }
Comments
Post a Comment