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.
How can I implement "Preview" in ASP.NET MVC?
-
26-06-2022 - |
문제
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?
해결책 2
다른 팁
You could use jquery window and post there your page's body by simple jquery text() function
제휴하지 않습니다 StackOverflow