I'm not able to perform action for button from second view, my folder path look like this:
我无法从第二个视图执行按钮操作,我的文件夹路径如下所示:
--Controllers
----LoginController
--Models
----LoginModel
--Views
----Login
------Login.cshtml
----Home.cshtml
In one controller I created 2 actions: one is Login and another is home. In Login view I created a button. When I click on it take to the controller, but when I click from home view it does nothing...
在一个控制器中,我创建了两个动作:一个是登录,另一个是家。在登录视图中,我创建了一个按钮。当我点击它拿到控制器,但当我从主视图点击它什么也没做...
1 个解决方案
#1
1
home.cshtml
@using (Html.BeginForm("Home", "Login", FormMethod.Post))
{
<input type='submit' value='Save' id='btnSave'>
}
Login.cshtml
@using (Html.BeginForm("Login", "Login", FormMethod.Post))
{
<input type='submit' value='Save' id='btnSave'>
}
#1
1
home.cshtml
@using (Html.BeginForm("Home", "Login", FormMethod.Post))
{
<input type='submit' value='Save' id='btnSave'>
}
Login.cshtml
@using (Html.BeginForm("Login", "Login", FormMethod.Post))
{
<input type='submit' value='Save' id='btnSave'>
}