title: Best practices for applying ASP.NET MVC Layout to Jquery.Mobile pages
body: <p>This question is close to: <a href="https://stackoverflow.com/questions/6875520/jquery-mobile-layout-in-asp-net-mvc-app">jQuery Mobile layout in ASP.NET MVC app</a> but I'm trying to find the best practices as I believe re-typing Header and Footer in every view is not efficient. There must be a better way.</p>
  
  <p>So, I'm looking for the best way to make ASP.NET MVC shared Layout views ( aka master pages ) to work with my Views/Partial views.</p>
  
  <p>From reading around there are two ways to render JQuery mobile pages from MVC Layouts:</p>
  
  <p>1) Standard Layout format:</p>
  
  <pre><code> &lt;!DOCTYPE html&gt; 
  &lt;html&gt; 
      &lt;head&gt; 
      &lt;title&gt;Page Title&lt;/title&gt; 
          ...
  &lt;/head&gt; 
  &lt;body&gt;
  &lt;div  data-role="page"&gt; 
      &lt;div  data-role="header"&gt;...&lt;/div&gt; 
      &lt;div  data-role="content"&gt;@RenderBody()&lt;/div&gt; 
      &lt;div  data-role="footer"&gt;...&lt;/div&gt; 
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>As I'm learning I started running into problems and later learned that you can't really load other "Pages" inside of that master payout. All inherited Views have to be part of that master Jquery mobile page.
  Bad.
  2) </p>
  
  <pre><code>    &lt;!DOCTYPE html&gt; 
  &lt;html&gt; 
      &lt;head&gt; 
      &lt;title&gt;Page Title&lt;/title&gt; 
          ...
  &lt;/head&gt; 
  &lt;body&gt;
  &lt;div  data-role="page"&gt;     
       @RenderBody()
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This will work but it also means that I have to re-type Headers and Footers on every single View.</p>
  
  <p>Can you guys share your opinions? What's the best approach to take for me to be able to load multiple Jquery Mobile "pages" in my Layout yet not having to repeat the Header/Footer everywhere ? ...I mean what if one has to change at some point ?</p>
  
  <p>Thank you in advance.</p>