没有javascript,就无法调用不同的操作.您可以调用相同的控制器操作,并在此操作内使用name属性确定按下了哪个按钮:
<% using (Html.BeginForm()) { %>
<input type="submit" name="save" value="Save" />
<input type="submit" name="update" value="Update" />
<% } %>
Run Code Online (Sandbox Code Playgroud)
并在您的控制器操作中:
[HttpPost]
public ActionResult Index(string save)
{
if (!string.IsNullOrEmpty(save))
{
// the save button was pressed
}
else
{
// the update button was pressed
}
return View();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
398 次 |
| 最近记录: |