I've recently had to build a preview function in a customer content management system, and came up with what seemed a fairly neat way of implementing this. The principle requirement was to allow users to preview content without making the change to the underlying data in the database, so allow them to roll-back or amend their changes until they were happy with them. At this point they would publish and the records in the database tables that represented the specific article would be updated. I planned to implement this using the Session object, in the following way: User clicks to edit an article - an article object is instantiated fromt the database and bound to the form. User updates the information and presses the Preview button. In an IFRAME, the main website article template is loaded and via a querystring parameter it is instructed to use the Article object hosted in the session, rather than retrieving it from the database as it would in the normal public view. The user can...
Senior Developer and head of DXP at Umbraco. Previously with Zone, building solutions primarily on .NET and using Umbraco, EPiServer and Sitecore CMS. This blog is used as a repository for various tips, tricks, issues and impressions drawn from the use of technology my work and interests. All words are my own.