2017-07-04 3 views
0

私のログインフォームをポップアップして提出しても、ポストメソッドでbeginformのコードを提供したにもかかわらずコントローラーにヒットしません。確認のため、ユーザー名とパスワードをコントローラに送信する必要があります。なぜそれが当たっていないのか理解できません。MVCのコントローラーに当たっていません

[HttpPost] 
    public ActionResult LoginUser(UserInfo objUser) 
    { 

     int res = udaObj.CheckUser(objUser.UserName, objUser.Password); 
     if (res >= 1) 
     { 
      return RedirectToAction("Appointment", "Home"); 
     }   
     else 
     { 
      //For testing purpose 
      return RedirectToAction("Appointment", "Home"); 
     } 
    } 

次のように私の見解は以下のとおりです。

@using (Html.BeginForm("LoginUser", "Home", FormMethod.Post, new { id = "loginForm" })) 
       { 
        <div class="tab-pane fade active in" id="signin"> 
         <fieldset> 
          <!-- Sign In Form --> 
          <!-- Text input--> 
          <div class="control-group"> 
           <label class="control-label" for="userid">Alias:</label> 
           <div class="controls"> 
            @* <input required="" id="userid" name="userid" type="text" class="form-control" placeholder="JoeSixpack" class="input-medium" required="">*@ 
            @Html.TextBoxFor(x => x.UserName, new { @class = "form-control input-large", @placeholder = "[email protected]", @required = "" , @id="userid" }) 
           </div> 
          </div> 

          <!-- Password input--> 
          <div class="control-group"> 
           <label class="control-label" for="passwordinput">Password:</label> 
           <div class="controls"> 
            @*<input required="" id="passwordinput" name="passwordinput" class="form-control" type="password" placeholder="********" class="input-medium">*@ 
            @Html.TextBoxFor(x => x.Password, new { @class = "form-control input-large", @placeholder = "********", @required = "", @type = "password" , @id="passwordinput" }) 
           </div> 
          </div> 

          <!-- Multiple Checkboxes (inline) --> 
          <div class="control-group"> 
           <label class="control-label" for="rememberme"></label> 
           <div class="controls"> 
            <label class="checkbox inline" for="rememberme-0"> 
             <input type="checkbox" name="rememberme" id="rememberme-0" value="Remember me" style="margin-left: 0px"> 
             Remember me 
            </label> 
           </div> 
          </div> 
          <button id="btnsignin" type="submit" name="signin" class="btn btn-success">Sign In</button> 
          <!-- Button --> 
          <div class="control-group"> 
           <label class="control-label" for="signin"></label> 
           <div class="controls"> 
            @* <button id="btnsignin" type="submit" name="signin" class="btn btn-success">Sign In</button>*@ 
           </div> 
          </div> 
         </fieldset> 
        </div> 
       } 
+0

送信ボタンがコメントされています。どのようにフォームを提出しますか? –

+0

デフォルト以外のルートはありますか? – Richard

+0

申し訳ありませんが、そのコメントブロックの上にコメントされていないもう1つのボタンが表示されます。同じコメントIDで –

答えて

0

チェックオブジェクトのUserInfoはあなたのビューで使用している同じモデルである場合。代わりにFormCollectionを使用してチェックしてください。

関連する問題