I have a gallery of images on a webpage and a "Print" button which then calls the browser print using window.print().
<button class="button current" id="printButton" onClick="window.print()">
Print
</button>
I have also used some CSS using @@media print to specify the page size.
This works very nicely and I have found no good reason to make this more complicated. However, when the user has completed or cancelled the print, it returns to the page and seems to refresh the page without triggering the controller. This loses various setting that have been sent to the page via the controller using ViewBag and TempData.
I don't really understand what is refreshing the page without a call being made to the controller, neither HttpGet nor HttpPost pick this up. Any suggestions?