2011-06-19 44 views
0

我試圖開發使用jQuery Mobile和ASP.NET MVC 3移動網站我有一個簡單的登錄觀點如下:jQuery Mobile的ASP.NET MVC3錯誤

<!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> 

下面的代碼我控制器:

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(); 
     } 
    } 

當單擊登錄按鈕時,我只是想將用戶重定向到主屏幕。但由於某些原因,我得到以下錯誤:

微軟JScript運行時錯誤:無法獲得屬性「_trigger」的值:對象爲空或未定義 行號2371:to.data(「頁」)。 _trigger(「beforeshow」,null,{prevPage:from || $(「」)});

任何人都可以幫我解決這個問題嗎?

回答

1

您必須在網頁上用標籤[data-role="page"]股利

<div data-role="page" data-theme="b"></div>