How to refresh dialog content
I have dialog tha contains a partialview. Is it possible to undo changes that the user makes inside the dialog, if the user decides to cancel the dialog and not to save?
If the user now opens the same dialog the changes are still there even if the user cancelled the dialog. I know that its possible to call the controller and replace the partial view.
Is there any other way?
sanke - you could store the contents of the div in a .data() element when the partialview is first loaded. Then, if it's cancelled (without saving), just push the .data() back in to div that was created for the dialog.
actions speak louder than words:
// the partial getting loaded $("#targetDiv").html(data); var foo = document.body; jQuery.data(foo, "myKey", data);
then on the cancel you could do the reverse:
// inside the dialog cancel event var foo = document.body; var data = jQuery.data(foo, "myKey"); $("#targetDiv").html(data);
give it a try...