Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8283849
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:53:26+00:00 2026-06-08T10:53:26+00:00

This question is close to: jQuery Mobile layout in ASP.NET MVC app but I’m

  • 0

This question is close to: jQuery Mobile layout in ASP.NET MVC app 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.

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.

From reading around there are two ways to render JQuery mobile pages from MVC Layouts:

1) Standard Layout format:

 <!DOCTYPE html> 
<html> 
    <head> 
    <title>Page Title</title> 
        ...
</head> 
<body>
<div  data-role="page"> 
    <div  data-role="header">...</div> 
    <div  data-role="content">@RenderBody()</div> 
    <div  data-role="footer">...</div> 
</div>
</body>
</html>

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)

    <!DOCTYPE html> 
<html> 
    <head> 
    <title>Page Title</title> 
        ...
</head> 
<body>
<div  data-role="page">     
     @RenderBody()
</div>
</body>
</html>

This will work but it also means that I have to re-type Headers and Footers on every single View.

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 ?

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T10:53:27+00:00Added an answer on June 8, 2026 at 10:53 am

    One thing I’ve done in similar situations is to make a master layout with no “page” div:

    <!DOCTYPE html> 
    <html> 
        <head>...</head>
        <body>
            @RenderBody()
        </body>
    </html>
    

    And then make layout pages which inherit from the master layout, where you can include the header/footer

    @{
        Layout = "~/Views/Shared/_LayoutMobileMaster.cshtml";
    }
    <div data-role="page" data-theme="b" position="fixed">
        <div data-role="header" data-position="fixed" data-theme="b" id="contentHeader">
            <a id="backBtn" data-direction="reverse" data-icon="back" class="ui-btn-left">Back</a>
            <h1>@ViewBag.Title</h1>
            <a id="logoutBtn" data-icon="gear" class="ui-btn-right">Logout</a>
        </div>
        <div data-role="content" data-theme="b">
            @RenderBody()
        </div>
    </div>
    

    Of course, if each of your pages has a different header/footer then this isn’t very practical; you might as well just do away with the intermediate layouts and put the header/footer directly in each of your views. But if you have different sets of multiple pages where each set needs to have a particular look, then I think this can be very useful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New question, but really close to need to refresh page in jquery mobile .
This is partly a jquery question, but most javascript. I just don't know javascript
I am sorry about how simple this question might be, but I cannot find
Duplicate of this question. Vote to close. Consider this at the windows commandline. scriptA.py
Have been working on this question for a couple hours and have come close
I haven't found this question, feel free to close if it's already up here.
If this is not a real question then feel free to close ;)
This is a two part question. The first is how do you properly close
I am risking this question being closed before i get an answer, but i
This question might be closed as it sounds vague but I'm really asking this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.