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
var foo = document.body;, "myKey", data);

then on the cancel you could do the reverse:

// inside the dialog cancel event
var foo = document.body;
var data =, "myKey");

give it a try...

Need Your Help

cannot create javascript closure

javascript syntax scope closures

trying to create functions in test.tgt the same as the functions in test.src except that they will will have a context.

json.RawMessage from database/sql json column getting overwritten

sql json go

Getting strange behaviour with a struct with embedded json.