Using mobile templates

Mobile templates lets you completely customize the presentation for mobile.

Creating a new template

Perform the following steps:

  • Create a new template in the Templates folder. Using a name such as templatename.mobile.aspx is a good convention often used elsewhere.
  • Code markup for your new template file.
  • Log into the edit interface. Click on the desktop version of the template. Fill in the field named 'Filepath mobile version'. (This will connect the two templates so the system knows that these two templates are simply different views of the same content.)     

coupling templates for mobile viewcoupling templates for mobile viewcoupling templates for mobile viewcoupling templates for mobile viewcoupling templates for mobile view

Once you save the template you will see the mobile version of the template apear in the list as a valid template and it will get a new icon.

You can now open both the desktop an the mobile template if you want to make changes to the code online. 

Using separate master pages instead of separate templates

Replacing your master page with a mobile master page is easy.

Use the IsMobile method like in the example below. 

private void Page_PreInit(object sender, EventArgs e) {
    if (WAFContext.Request.IsMobile) {
            this.MasterPageFile = "~/MasterPages/MobileMasterPage.master";
    }
}