I have created a new project with default data.
So i have a Mobile master page and a Desktop master page.
How can i make 1 page look diferently on desktop and mobile? Somehow create two Default.aspx pages? One for mobile, one for desktop.
I have tried using the ContentPlaceholders:
Desktop:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="<Projectname>.SiteMaster" %>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<asp:ContentPlaceHolder ID="MainContent" runat="server"></asp:ContentPlaceHolder>
</body>
</html>
Mobile:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.Mobile.master.cs" Inherits="<Projectname>.Site_Mobile" %>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<asp:ContentPlaceHolder ID="MobileMainContent" runat="server"></asp:ContentPlaceHolder>
</body>
</html>
Default.aspx:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="<Projectname>._Default" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
Hello, i'm desktop!
</asp:Content>
<asp:Content ID="MobileBodyContent" ContentPlaceHolderID="MobileMainContent" runat="server">
Hello, i'm mobile!
</asp:Content>
When i launch Default.aspx from Desktop browser it prompts that MobileMainContent is not found. But on WP emulator i get that MainContent is not found;
The i made modifications in my Master mobile and same to the Master desktop, but hide the other block:
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.Mobile.master.cs" Inherits="<Projectname>.Site_Mobile" %>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<asp:ContentPlaceHolder ID="MainContent" runat="server" Visible="false"></asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="MobileMainContent" runat="server"></asp:ContentPlaceHolder>
</body>
</html>
And all works. Is this the correct approach to achieve what i want?