2013-10-12 4 views
1

Following my previous question을 마스터 레이아웃을 사용하는 경우 작동하지 않는 제출, ​​지금은 상황이 다시 작동하지 않습니다 여기 간다형태의 버튼보기

컨트롤러 (즉, 사후 조치를 얻어야한다) :

public class GeneralController { 
    [HttpPost] 
    public ActionResult SearchResults(SearchParamsModel searchParams) 
    { 
     // doin some stuff here 
     return View("SearchResultsView"); 
    } 
} 

보기 (.cshtml) :

@model MVC.Models.SearchParamsModel 

@{ 
    ViewBag.Title = "SomeTitle";  
} 

@Html.Partial("~/Views/SomePartials/ssi-header.cshtml"); 
@Html.Partial("~/Views/SomePartials/ssi-sidebar-notifications.cshtml"); 

<!-- content --> 
<section class="content right"> 
    <section class="some-search"> 

     <div class="form-separator gradient"></div> 

     @using (Html.BeginForm("SearchResults", "Home", FormMethod.Post))   
     {         
        <section class="form-field"> 
         <input type="text" name="City" id="City" class="field field139 autocomplete-init-no-img" /> 
         <label for="City">City</label> 
        </section>        

      <input type="submit" value="Submit Search" class="submit btn blue-btn special-submit" /> 

     } 
    </section> 
</section> 
<!-- end content --> 
@Html.Partial("~/Views/SomePartials/ssi-footer.cshtml"); 

모델 :

public class SearchParamsModel 
{ 
    public string City{ get; set; } 
} 

내가보기에 추가 할 경우 상황은 작업 :이 질문에 대해 답처럼 Layout = null (! 이상한)

내 레이아웃

<!DOCTYPE html> 
<html lang="en"> 
    <head> 
     <meta charset="utf-8" /> 
     <title>@ViewBag.Title - My ASP.NET MVC Application</title> 
     <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" /> 
     <meta name="viewport" content="width=device-width" /> 
     @Styles.Render("~/Content/SomeStyles") 
     @*@Scripts.Render("~/bundles/SomeScripts")*@ 

     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
     <script src="../../Scripts/script1.js" type="text/javascript"></script> 
     <script src="../../Scripts/script2.js"></script> 
     .... 

    </head> 
    <body> 
     <div id="body"> 
      @RenderSection("featured", required: false) 
      <section class="content-wrapper main-content clear-fix"> 
       @RenderBody() 
      </section> 
     </div> 
     @*@RenderSection("scripts", required: false)*@ 
    </body> 
</html> 
+0

레이아웃 페이지의 코드를 게시 할 수 있습니까? –

+0

추가, 위 참조 (스크립트 이름을 "SomeScripts"등으로 변경) – user1025852

+0

집 대신 일반용 컨트롤러에 게시하면 안됩니까? @using (Html.BeginForm ("SearchResults", "General", FormMethod.Post)) – hjgraca

답변

1

이전 질문은 일반 컨트롤러가 아닌 일반 컨트롤러에 게시해야합니다.

@using (Html.BeginForm("SearchResults", "General", FormMethod.Post)) 

건배.