从视图中调用 actionresult
Calling actionresult from view
这是我的 ActionResult()
public ActionResult pay()
{
return View();
}
[HttpPost]
public ActionResult mytry()
{
return View();
}
这是我的观点pay.chtml
@using (Html.BeginForm("mytry", "Home"))
{
<table>
<tr>
<td align="center">
<input type="button" value="submit" />
</td>
</tr>
</table>
}
我无法从这里调用 mytry() 操作结果。怎么做?
要提交表单,您必须使用 <input type="submit" />
或 <button type="submit">
尝试以下操作:
@using (Html.BeginForm("mytry", "Home", FormMethod.Post))
{
<table>
<tr>
<td align="center">
<input id="btnSubmit" type="submit" value="Submit" />
</td>
</tr>
</table>
}
这是我的 ActionResult()
public ActionResult pay()
{
return View();
}
[HttpPost]
public ActionResult mytry()
{
return View();
}
这是我的观点pay.chtml
@using (Html.BeginForm("mytry", "Home"))
{
<table>
<tr>
<td align="center">
<input type="button" value="submit" />
</td>
</tr>
</table>
}
我无法从这里调用 mytry() 操作结果。怎么做?
要提交表单,您必须使用 <input type="submit" />
或 <button type="submit">
尝试以下操作:
@using (Html.BeginForm("mytry", "Home", FormMethod.Post))
{
<table>
<tr>
<td align="center">
<input id="btnSubmit" type="submit" value="Submit" />
</td>
</tr>
</table>
}