Creating the Workspace
Let’s start by creating a work area for the CMS Explorer tool. Create a new Visual C# MCMS Web Application Project in Visual Studio .NET.
1. Name the new project
CMSExplorer
.2. Get the
Styles.css
file from the book’s code download. Select Project | Add Existing Item and add it to the CMSExplorer project.3. Create a new folder and name it
images
. Download the image files for this tutorial from the code download section of the book’s companion website and add them to the project.4. Right-click the CMSExplorer project in the Solution Explorer and select Properties. Click Designer Defaults. Set the Page Layout field to Flow. This will set the default layout to flow instead of grid for all web forms created in the project. Click OK.
5. Right-click the Console folder and select Delete.
6. Add a new web form to the CMSExplorer project, and name it
default.aspx
.7. In Design view, drag and drop the
Styles.css
file from Solution Explorer onto the form. This applies the stylesheet to the page.8. Switch to HTML view. Add the table below between the
<form>
tags to provide the basic structure of the page. We use alitCurrentContainer
Literal control to display the name of the current container. ThelblPublishingMode
Label will be used later to display the current publishing mode.<table cellSpacing="0" cellPadding="0"> <tr> <td> <table> <tr> <td valign="top"> <asp:Image runat="server" ID="imgTitle"></asp:Image> </td> <td valign="center"> <h1> <asp:Literal ID="litCurrentContainer" runat="server"/> </h1> </td> </tr> </table> <asp:Label ID="lblPublishingMode" runat="server" CssClass="BodyText"/> </td> </tr> <tr> <td width="100%" bgcolor="#cccccc">(Space for Toolbar)</td> </tr> <tr> <td>(Space for DataGrid)</td> </tr> </table>
9. Toggle to Design view. Double-click on the form to get to its code-behind file. Above the namespace declaration, import the
Microsoft.ContentManagement.Publishing
namespace.//MCMS PAPI using Microsoft.ContentManagement.Publishing; namespace CMSExplorer { /// <summary> /// Summary description for _default. /// </summary> public class _default : System.Web.UI.Page { . . . code continues . . . } }