How to: Create a Content Page

 

Applies To: Windows Server 2012 Essentials, Windows Home Server 2011, Windows Storage Server 2008 R2 Essentials, Windows Small Business Server 2011 Essentials

A Content page is an .aspx file that you can use to provide additional content to your website.

The WebAddin template provides a Default.aspx file that you can use as the default page for your add-in. If you want to add more pages to your add-in, you can use the item template named ContentPage that is provided in the SDK.

Note

If you have not already created a new project, complete the procedure listed in How to: Create a New Project For Your Remote Web Access Add-In.

To add content to an .aspx page

  1. Open the .aspx file. You can change the Default.aspx file or you can change a ContentPage.aspx file that you add to the project.

  2. Add new information to the Content element with the identifier of ContentDefault. For example, you can add a label to the page. To do this, ensure that the ContentDefault contains the following code:

    <asp:Label ID="Label1" runat="server"   
       Text="Hello Default World"></asp:Label>  
    
  3. (Optional) You can add JavaScript to your page. To do this, see the following example:

    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">  
       <Scripts>  
          <asp:ScriptReference Path="utils.js" />  
       </Scripts>  
    </asp:ScriptManagerProxy>  
    
  4. Save the .aspx file.

  5. Publish the application.

To include a CSS file

  1. Open the .aspx file. You can change the Default.aspx file or you can change a ContentPage.aspx file that you add to the project.

  2. In Solutions Explorer, right-click the project, click Add, and then click Existing Item.

  3. Locate your CSS file and then click Add.

  4. Add the name of the CSS file to the Src attribute of the CSSLoader element in HeaderDefault Content element.

    <asp:Content ID="HeaderDefault" ContentPlaceHolderID="head" runat="server">  
       <wfxc:CssLoader ID="CssLoader1" Src="style.css" runat="server"/>  
    </asp:Content>  
    
  5. Add the CSSClass attribute to define page elements based on your CSS file. For example, add the CSSClass attribute to the previously defined Label to change the attributes of the text:

    <asp:Label ID="Label1" runat="server" Text="Hello World" CssClass="title"></asp:Label>  
    
  6. Save the .aspx file.

  7. Publish the application.