I am currently working with MVC3 and Bootstrap Responsive. My goal is to determine through Razor (or javascript) which mode - desktop, tablet, or phone - is active in order to display the appropriate partial view based on the mode.
Here's an example of what I want to achieve:
@if( mode=='phone')
{
@html.Partial("_partialPhone")
}
@if( mode=='desktop')
{
@html.Partial("_partialDesktop")
}
...and so on
I prefer not to solely rely on ".visible-phone", "visible-tablet", and ".visible-desktop" css classes as they cause all partial views to be loaded in the DOM and rendered by the Razor engine, even though only one is displayed. This can negatively impact performance on phones and tablets.
If anyone has any suggestions or guidance on how to accomplish this task, it would be greatly appreciated.
Thank you.