2013-08-17 31 views
0

我有我的LoginRrgister.chtml第2種形式如下:如何編寫mvc4有2種形式控制器在一個單一的Razor視圖

@using (Html.BeginForm("Tests1", "Test", FormMethod.Post, 
         new { id = "FormSearch1" })) 
{ 
    <input type ="submit" value="Filter1 " id="submit" /> 
} 

和另一種形式如下:

@using (Html.BeginForm("Tests2", "Test", FormMethod.Post, 
         new { id = "FormSearch2" })) 
{ 
    <input type ="submit" value="Filter2 " id="save" /> 
} 

所以這次如何寫控制器的動作結果?

回答

0
[HttpPost]  
public ActionResult Test1() 
{ 
    ViewBag.Message = "Your app description page."; 
    return View("sameViewForBoth"); 
} 

[HttpPost]  
public ActionResult Test2() 
{ 
    ViewBag.Message = "Your app description page."; 
    return View("sameViewForBoth"); 
} 
相關問題