【发布时间】:2011-03-02 13:18:37
【问题描述】:
我从一个移动页面导航到另一个页面,页面出现但页面上的控件
不会出现, 我正在使用带有剃须刀的 jquery mobile 和 mvc 3 这是我的代码
用于操作的主导航链接控制器。
public ActionResult List()
{
if (Request.Browser.IsMobileDevice)
{
return View("List");
}
else
return View("ListM");
}
查看将导航文件控制器的链接
@{
Page.Title = "ListM";
Layout = "~/Views/Shared/_LayoutMob.cshtml";
}
<div>
<ul data-role="listview" >
<li>
@Html.ActionLink("FileLink", "List", "File")
</li>
</ul>
</div>
这是 _LayoutMob.cshtml 页面(和 master 一样)
<!DOCTYPE html>
@using DomainModel.Extentions;
<html lang="en">
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>
<style type="text/css">
body { background: #dddddd;}
.gmap { height: 330px; width: 100%; margin: 0px; padding: 0px }
</style>
</head>
<body data-role="page" data-theme="e">
@RenderBody()
</body>
</html>
这是给控制器的(即导航应该到达的链接)
public ActionResult List()
{
if (Request.Browser.IsMobileDevice)
{
return View("ListM");
}
}
我使用的浏览器是Mozilla Firefox、IE8和iBB Demo2。
【问题讨论】:
-
如果
Request.Browser.IsMobileDevice为假怎么办?您是否还有每个路由的视图,List和ListM位于与关联控制器链接的视图目录中或共享目录中?
标签: jquery asp.net-mvc mobile razor