Exam Question
Drag and Drop
You are developing an ASP.NET MVC application in Visual Studio 2012. The application will be viewed with browsers on desktop devices and mobile devices. The application uses the Razor View Engine to display data.The application contains two layouts located in the /Views/Shared directory.
These layouts are named:
_Layout.cshtml
_MobileLayout.cshtml
The application must detect if the user is browsing from a mobile device. If the user is browsing from a mobile device, the application must use the _MobileLayout.cshtml file. If the user is browsing from a desktop device, the application must use .Layout, cs html.
You need to ensure that the application renders the layout that is appropriate for the browser.
- Layout = "~/Views/Shared/_Layout.cshtml";
- Layout="~/Views/Shared/_MobileLayout.cshtml";
- Request.Browser.IsBrowser("MobileDevice");
- Request.Browser.IsMobileDevice
- Layout= new MasterPage("_Layout.cshtml")
- Layout= new MasterPage("_MobileLayout.cshtml")
@{
if (
} else {
}
}