This question is close to: jQuery Mobile layout in an ASP.NET MVC application , but I am trying to find best practices because I believe that retyping the header and footer in all views is inefficient. There must be a better way.
So, I'm looking for the best way to do general ASP.NET MVC (aka master pages) layout views 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 found out, I started to run into problems, and later found out that you cannot load other “Pages” inside this main payout. All inherited views must be part of this jQuery main page. Poorly. 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-enter headers and footers on each view.
Can you guys share your opinion? What is the best approach for me to be able to load multiple JQuery Mobile pages in my layout, but don’t need to repeat the header everywhere? ... I mean, what if at some point you need to change?
Thanks in advance.
jquery-mobile asp.net-mvc
Shenaniganz
source share