Products Technologies Demo Docs Blog Support Company

MVC: Replace the File Menu with a Backstage View Menu

Microsoft Word provides a very smart way to manage documents and related data such as metadata and personal information in a separate view: The backstage view. The ribbon bar contains commands for working in a document and the backstage view provides options and commands to do to a document. From a UX (user experience) point of view, the backstage view is very interesting. The user can focus on a specific task such as saving the document. A usual dialog box doesn't hide the document and…

MVC: Replace the File Menu with a Backstage View Menu

Microsoft Word provides a very smart way to manage documents and related data such as metadata and personal information in a separate view: The backstage view. The ribbon bar contains commands for working in a document and the backstage view provides options and commands to do to a document.

From a UX (user experience) point of view, the backstage view is very interesting. The user can focus on a specific task such as saving the document. A usual dialog box doesn't hide the document and doesn't provide as much space that is available in the backstage view.

In this project, a sample backstage view is implemented and opened when the user clicks on the ribbon FILE menu.

MVC: Replace the file menu with a backstage view menu

The following Javascript disables the original file menu in order to attach the backstage view on clicking the FILE menu:

TXTextControl.addEventListener("ribbonTabsLoaded", function (e) {
    // remove the original file menu
    $("#fileMenu").remove();

    // open the new menu when the FILE menu is clicked
    $("#tabFile").on("click", function () {
        animateBackstage(0);
    });

    animateBackstage(1);
});

The backstage view itself consists of simple DIV elements and an unordered list for the vertical menu:

<div id="backstage" class="backstage">
  <div class="menu">
      <a onclick="animateBackstage(1)" href="#"><img src="~/img/back.png" /></a>
      <ul id="menu">
          <li><a id="View1" onclick="switchBackstageView('View1')" href="#">View 1</a></li>
          <li><a id="View2" onclick="switchBackstageView('View2')" href="#">View 2</a></li>
          <li><a id="View3" onclick="switchBackstageView('View3')" href="#">View 3</a></li>
          <li><a id="View4" onclick="switchBackstageView('View4')" href="#">View 3</a></li>
      </ul>
  </div>
  <div id="title" class="title"></div>
  <div id="stage" class="stage"></div>
</div>

When a menu link is clicked, the function switchBackstageView is loading an MVC partial view dynamically:

function switchBackstageView(view) {
    $('#menu li a').each(function () {
        $(this).removeClass("active");
    });

    // add the title
    $("#title").html("<h1>" + view  + "</h1>");
    $("#" + view).addClass("active");

    // load the partial view dynamically
    $("#stage").load("/home/getview", { viewName: view });
}

This blog entry will be part of a series that shows how to add several tasks to a backstage view such as loading, saving and printing documents. Stay tuned!

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

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

GitHub

Download and Fork This Sample on GitHub

We proudly host our sample code on github.com/TextControl.

Please fork and contribute.

Download ZIP

Open on GitHub

Open in Visual Studio

Requirements for this sample

  • Visual Studio 2012 or better
  • TX Text Control .NET Server (trial sufficient)

ASP.NET

Integrate document processing into your applications to create documents such as PDFs and MS Word documents, including client-side document editing, viewing, and electronic signatures.

ASP.NET Core
Angular
Blazor
JavaScript
React
  • Angular
  • Blazor
  • React
  • JavaScript
  • ASP.NET MVC, ASP.NET Core, and WebForms

Learn more Trial token Download trial

Related Posts

ASP.NETGitHubHTML5

MVC: Loading Files from the Backstage Menu

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…


ASP.NETGitHubHTML5

MVC: Replace the Ribbon Table Menu with a Quick Insert Table Drop-down

MS Word provides a quick insert table drop-down to insert tables into the document. This sample shows how to replace the insert table button with such a table insert drop-down. The replacement and…


ASP.NETGitHubHTML5

MVC: Arrange a Docked Web.TextControl with a Custom Bar at the Top

Consider the following task: The Web.TextControl should be arranged under a custom bar that is located at the top of the page like in the following screenshot: Objects such as DIV elements doesn't…


ASP.NETGitHubHTML5

MVC: Autosave and Restore Documents to and from the Local Browser Storage

Modern HTML5-based web browsers support persistent data storage with an enhanced capacity up to 50MB local storage. It is possible to store data persistently or session based. This sample shows…


ASP.NETGitHubHTML5

MVC: Loading and Saving Documents Through Controller HttpPost Methods

With the release of TX Text Control X13, we released an MVC version of TXTextControl.Web that is available through NuGet. This sample project shows how to load and save documents using controller…