Happy New Year, everybody!

In the last blog entry, we showed how to replace the file menu with an MS Word-style backstage menu. This project shows how to load documents from a partial view in the backstage menu.

MVC: Loading files from the backstage menu

The partial backstage view Open.cshtml uses a very simple model to describe a document:

Loading...

In the partial view, a list item is created for each file of the given model:

Loading...

The controller ActionResult GetView iterates through all files of a given directory in order to create the view model that is used in the above partial view:

Loading...

If a file is clicked in the view, the following Javascript loads a document from the controller HttpPost method LoadTemplate:

Loading...

The controller method LoadTemplate loads the selected file into a temporary ServerTextControl and returns the document in the internal TX Text Control format which is loaded client-side using Javascript into TX Text Control.

Loading...

Download the sample from GitHub and test it on your own.