ASP.NET MVC 3 Razor capability with Visual Studio 2010 has rich support for Mobile Devices. But , in Project development we have to keep all CSS, JQuery, JavaScript files to keep in touch , Copy & Paste in Project Folder / Drag & Drop. For Mobile Specific Views keep in mobile Section all Mobile Javascript, mobile.css, JQuery for Mobile files etc..
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(“blackberry”)
|| userAgent.Contains(“mobile”)
|| userAgent.Contains(“windows ce”)
|| userAgent.Contains(“opera mini”)
|| userAgent.Contains(“palm”)
|| userAgent.Contains(“fennec”)
|| userAgent.Contains(“adobeair”)
|| userAgent.Contains(“ripple”)
);
return isMobile;
- Next , Run the MVC 3 web application & check the view in desktop as well as in Windows Phone.
Desktop – View
Mobile- 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.
- JQuery for Mobile with rich .css & javascript support. No need to download seperately & copy, paste or make seperate 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.
You must be logged in to post a comment.