Optionally provide private feedback to help us improve this article...

Thank you for your feedback!


The InstantForum Master Page

Each skin within InstantForum contains a standard ASP.NET master page file allowing you to easily wrap existing rich templates around InstantForum.

The master page file can be found within the root of each InstantForum skin directory. Each skin can have a different masterpage template. For example if you wanted to wrap an existing web site design around our "Classic" skin you would navigate to "\Skins\Classic\MasterPage.Master"

Open this within Visual Studio (or NotePad) and you should see the following template…


Understanding the MasterPage.Master File

The basic structure for the InstantForum master page is as follows...

<%@ Master Language="cs" Inherits="InstantASP.InstantForum.UI.Controls.Master" EnableViewState="false" %>
<%@ Register tagPrefix="InstantASP" Namespace="InstantASP.Common.UI.WebControls" Assembly="InstantASP.Common.UI" %>
<%@ Register tagPrefix="InstantForum" Namespace="InstantASP.InstantForum.UI.Controls" Assembly="InstantASP.InstantForum.UI" %>
<%@ Register tagPrefix="InstantForumWebControls" Namespace="InstantASP.InstantForum.UI.WebControls" Assembly="InstantASP.InstantForum.UI" %>
<!DOCTYPE HTML>
<!--[if lt IE 7 ]><html class="ie6"><![endif]-->
<!--[if IE 7 ]><html class="ie7"><![endif]-->
<!--[if IE 8 ]><html class="ie8"><![endif]-->
<!--[if IE 9 ]><html class="ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html><!--<![endif]-->
<head id="ctlHeader" runat="server">
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>

<form id="form1" runat="server"> 
    <div id="contentWrapper" class="contentWrapper">
        <div class="contentPadding">            
<InstantASP:Literal ID="lblWrapperHeader" runat="server" />                                
            <div class="bodyWrapper">     
                <div class="contentPadding">                    
           <asp:contentplaceholder id="ctlContentPlaceHolder" runat="server"/>                                
                </div> 
            </div>    
<InstantASP:Literal ID="lblWrapperFooter" runat="server" />                    
        </div>    
    </div>  
</form>
        
</body>
</html>

To assist we've detailed each key line below…

<InstantASP:Literal ID="lblWrapperHeader" runat="server" />

If you provide a wrapper within the Admin CP the wrapper HTML header code will be rendered by this label. 

<asp:contentplaceholder id="ctlContentPlaceHolder" runat="server"/>
This content placeholder is the location all forum mark-up will e added. 
<InstantASP:Literal ID="lblWrapperFooter" runat="server" />

If you provide a wrapper within the Admin CP the wrapper HTML footer code will be rendered by this label.

Wrapping your design around the forum

To wrap your existing HTML around InstantForum you should add your header HTML just before the <InstantASP:Literal ID="lblWrapperHeader" runat="server" /> control and your footer HTML just after the the <InstantASP:Literal ID="lblWrapperFooter" runat="server" /> label control.

If your header or footer HTML contains links to images or other pages on your main web site you will need to ensure you provide absolute URLs for your hyperlinks within the InstantForum master page to ensure your links still work. For example an image maybe

<img src="https://yourdomain.com/images/companylogo.gif" />.

If you use relative URLs for your links or images and InstantForum is installed within a child folder off your main web site you can use relative links providing you use the correct paths within the masterpage. For example an image maybe

<img src="../images/companylogo.gif" />.

This would link to an image in your "Images" folder on your main web site.

 Using rich server side controls within the MasterPage

As this is a standard ASP.NET master page you can include 3rd party UI controls such as JavaScript based navigation controls. Or standard ASP.NET server controls such as the ASP.NET membership controls.

For example lets say you would like to add ASP.NET user controls to render the forum header & footer you can include user controls like so...

<%@ Master Language="cs" Inherits="InstantASP.InstantForum.UI.Controls.Master" EnableViewState="false" %>
<%@ Register tagPrefix="InstantASP" Namespace="InstantASP.Common.UI.WebControls" Assembly="InstantASP.Common.UI" %>
<%@ Register tagPrefix="InstantForum" Namespace="InstantASP.InstantForum.UI.Controls" Assembly="InstantASP.InstantForum.UI" %>
<%@ Register tagPrefix="InstantForumWebControls" Namespace="InstantASP.InstantForum.UI.WebControls" Assembly="InstantASP.InstantForum.UI" %>
<%@ Register tagprefix="InstantASP" Tagname="Header" src="CustomControls/Header.ascx" %>
<%@ Register tagprefix="InstantASP" Tagname="Footer" src="CustomControls/Footer.ascx" %>

<!DOCTYPE HTML>
<!--[if lt IE 7 ]><html class="ie6"><![endif]-->
<!--[if IE 7 ]><html class="ie7"><![endif]-->
<!--[if IE 8 ]><html class="ie8"><![endif]-->
<!--[if IE 9 ]><html class="ie9"><![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html><!--<![endif]-->
<head id="ctlHeader" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div class="contentWrapper">
<div class="contentPadding">
<InstantASP:Header runat="server"/>
<InstantASP:Literal ID="lblWrapperHeader" runat="server" />
<asp:contentplaceholder id="ctlContentPlaceHolder" runat="server"/>
<InstantASP:Literal ID="lblWrapperFooter" runat="server" />
<InstantASP:Footer runat="server"/>
</div>
</div> 
</form>
</body>
</html>

Using Inline Code within the MasterPage

You can use inline ASP.NET code within your master page. For example if you wanted perform a redirect within our software you could use the masterpage.master file to add code as shown below..

As the master page is used for every page this code will be executed on all front-end pages.

Adding inline code within the MasterPage.Master avoids the need to recompile the solution.

The InstantForum Admin CP Master Page

We use a separate master page for the InstantForum Admin Area. This master page can be found within the root of each skin directory and is called  "Admin.Master".