How to get the CSS width of a mobile device in ASP.NET MVC?
In ASP.NET MVC, how do I get the width of the screen in terms of css pixels? I'm on a Nexus 5, and if I do
Request.Browser.ScreenPixelsWidth, it gives me the width in terms of the pixel density (that is 1080), but what I am trying to get is the CSS width, should be more like 480px.
One solution is to simply use JQuery's Window Width -
$(window).width() - populate that in to the hiddenfield and you can get it on the server side in FormCollection.