What If we have a seperate Template in Visual Studio 2010 for Mobile Ready ASP.NET MVC3 Razor Teamplete & JQuery for Mobile like this.
- For JQuery for Mobile ASP.NET & ASP.NET MVC .
- On starting project with Mobile Ready ASP.NET MVC 3 Template, we got inbuilt support of MobileViewEngine file which helps to render the desktop MVC web application to mobile browser by detecting the User-Agent.
- Having help for Mobile Specific View of websites without using any mobile.browser file or WURFL database. No need to write any extra code for mobile browser rendering logic .
- Put the simple logic here: (Already Available in ApplicationHelper.cs in the default project installed with template)
publicstaticbool IsSupportedMobileDevice(thisHttpRequestBase request)
bool isMobile = request.Browser.IsMobileDevice;
string userAgent = request.UserAgent.ToLowerInvariant();
isMobile = isMobile || (userAgent.Contains( “iphone”)
|| userAgent.Contains(“windows ce”)
|| userAgent.Contains(“opera mini”)
- Next , Run the MVC 3 web application & check the view in desktop as well as in Windows Phone.
Desktop – View
- To get the Rich Template in Visual Studio 2010 , go to Tools -> Extension Manager -> Search Online Templates -> Select ASP.NET MVC3 Razor Mobile Ready Template & JQuery for Mobile Template.
- Download it & Install in your Visual Studio 2010 & Enjoy building MVC 3 Razor Website Ready for Mobiles with rich support API of HTML 5, JQuery.
- Install in Visual Studio 2010 as default template instead of copy & paste in Project/Item Template of Visual Studio 2010 folders.
- Lets work with Visual Studio 2010 installed templates of Mobile Ready ASP.NET MVC 3 Razor & JQuery for Mobile with HTML 5.