Link to home
Start Free TrialLog in
Avatar of pointeman
pointemanFlag for United States of America

asked on

Responsive Web Design and MVC4 Confusion?

yea, been searching the Internet for ASP.NET MVC4 Responsive Design ideas and now just confused. I've found two distinct methodologies:
1. Use the Global.asax to detect the browser client type
2. Use CSS to detect actual browser width.

I'm opting for #2 because It's cool to resize a browser by clicking it's corner and watching the screen change before my eyes.

I need an easy 1-2-3 example of how to:
1. detect the screen size
2. reference the correct _layout
3. layout hierarchy
    - _Layout.cshtml (full site)
    - _Layout.Phone or _Phone.Layout or mobile.Layout.Phone???

Help this poor old Web Forms programmer please...

Avatar of Craig Wagner
Craig Wagner
Flag of United States of America image

Avatar of pointeman


Nice link, I found that one too. Not much help unless someone explains the details to me.

Q. Is the following code placed in the Global.asax?

DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("WP7") {    ContextCondition = ctx => ctx.GetOverriddenUserAgent().Contains("Windows Phone OS")});

Q. Can a CSS Media Query redirect to _Layout.Mobile.cshtml?

I like the idea of seperate _Layout's , just unsure how to detect browser resizing and _Layout redirection...

Help again...
Avatar of pointeman
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Best answer (links) I can find...