ASP.NET MVC - Working with Editor Templates on Mobile Display mode -
i'm adapting asp.net mvc 5 web application better fit on mobile devices. followed example of basic implementation of display mode feature.
this working fine when returning view controller, i.e., view called myview.cshtml
serve myview.mobile.cshtml
file.
inside view call editor template this:
@html.editorfor(model => model.someproperty)
i expected behavior same when using editor , display templates, so, added file /editortemplates/someproperty.mobile.cshtml
, appears not working.
it works fine on desktop, on mobile version blank template should displayed.
could missing here or maybe not supported?
as workaround, implemented snippet http://detectmobilebrowsers.com/ check if mobile , ended doing this:
@{ var ismobile = (bool)viewbag.ismobile; } @foreach (var m in model.someproperty) { @html.partial(string.format("~/views/editortemplates/someproperty{0}.cshtml", ismobile ? ".mobile" : ""), m) }
Comments
Post a Comment