Search code examples
asp.net-mvcpreviewtransactionscope

How can I implement "Preview" in ASP.NET MVC?


Let's say I have a controller called Pages. In this controller, I have 3 actions: Create, Edit, Details.

In Create and Edit, in addition to the "Save" button, I want to have a "Preview" button, which loads Details in a new tab with the temporary data.

What's the best way to do that?

I thought about using TransactionScope, but how do I share it across multiple requests?


Solution

  • You can just send data by post to controller action, render new details view and post back the page without saving changes to the database. That should work as "preview". You can do this by ajax as well to increase interactivity.