I am trying to develop a mobile site using jQuery mobile and ASP.NET MVC 3. I have a simple login view as follows:
我正在尝试使用jQuery mobile和ASP.NET MVC 3开发移动站点。我有一个简单的登录视图,如下所示:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Links.Content.Site_css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script src="@Links.Scripts.jquery_1_5_1_min_js" type="text/javascript"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>Login</h1>
</div>
<div data-role="content">
@using (Html.BeginForm())
{
<div data-role="fieldcontain">
<label for="username">Username:</label>
<input type="text" name="username" id="username" value="" />
</div>
<div data-role="fieldcontain">
<label for="password">Password:</label>
<input type="password" name="password" id="password" value="" />
</div>
<div data-role="fieldcontain">
<fieldset data-role="controlgroup">
<legend></legend>
<input type="checkbox" name="rememberMe" id="rememberMe" class="custom" />
<label for="rememberMe">Remember Me</label>
</fieldset>
</div>
<input type="submit" value="Login" data-theme="e" />
}
</div>
<div data-role="footer">
</div>
</div>
</body>
</html>
Below is the code for my controller:
以下是我的控制器的代码:
public partial class AccountController : Controller
{
[HttpGet]
public virtual ActionResult Login()
{
return View();
}
[HttpPost]
public virtual ActionResult Login(string username, string password)
{
return MVC.Admin.Home.Index();
}
}
When the login button is clicked I just want to redirect the user to the home screen. But for some reason I get the following error:
单击登录按钮时,我只想将用户重定向到主屏幕。但由于某种原因,我收到以下错误:
Microsoft JScript runtime error: Unable to get value of the property '_trigger': object is null or undefined Line Number 2371: to.data( "page" )._trigger( "beforeshow", null, { prevPage: from || $("") } );
Microsoft JScript运行时错误:无法获取属性'_trigger'的值:object为null或undefined行号2371:to.data(“page”)._ trigger(“beforeshow”,null,{prevPage:from || $( “”)});
Can anyone help me with this issue?
任何人都可以帮我解决这个问题吗?
1 个解决方案
#1
1
You must include the div with tag [data-role="page"]
on your page
您必须在页面上包含带有[data-role =“page”]标记的div
<div data-role="page" data-theme="b"></div>
#1
1
You must include the div with tag [data-role="page"]
on your page
您必须在页面上包含带有[data-role =“page”]标记的div
<div data-role="page" data-theme="b"></div>