我有多種形式.NET多個表單在一個頁面上的問題
@using (Html.BeginForm("Withdrawal", "ATMControl", FormMethod.Post, new {}))
{
//code
}
@using (Html.BeginForm("Deposit", "ATMControl", FormMethod.Post, new {}))
{
//code
}
@using (Html.BeginForm("transfer", "ATMControl", FormMethod.Post, new {}))
{
//code
}
在我的控制器視圖:
//this works
public ActionResult Index()
{
SetViewBagAccounts();
return View();
}
//this doesnt
[HttpPost]
public ActionResult Withdrawal(ATMModel model)
{
//do your login code here
return View();
}
什麼,我試圖做的是過程取款,存款和轉移indiviually在這個控制器中。 我不斷收到此錯誤
找不到資源。
說明:HTTP 404.您正在查找的資源(或其某個依賴項)可能已被刪除,名稱已更改或暫時不可用。請檢查以下網址並確保它拼寫正確。
請求的URL:/ ATMControl /退學
什麼是你的控制器的名稱? – musefan
ATMController。我拼錯了我的控制器,但我做了修復,仍然是相同的錯誤 – kayze
您需要刪除「控制器」部分,只需在使用「ATM」時提及控制器。 MVC的魔術將解決 – musefan