【发布时间】:2013-10-16 20:15:15
【问题描述】:
查看:
@using (@Html.BeginForm("Show", "test", FormMethod.Post))
{
<fieldset>
<table >
<tr>
<td>
@Html.LabelFor(model=> model.Show)
</td>
<td>
@Html.TextBox("txtvalue", null)
</td>
</tr>
</table>
<input type="button" value="Show" onclick = "@("location.href='"+ @Url.Action("Show", "test")+"'" )" />
<input type="button" value="Go" onclick ="@("location.href='"+ @Url.Action("Go", "test")+"'" )"/>
</fieldset>
}
以及控制器中的两个动作方法,
public ActionResult Show(string txtvalue)
{
...
}
public ActionResult Go(string txtvalue)
{
...
}
根据被点击的按钮,它应该转到相应的动作方法并传递文本框的值。
谁能给我建议的方法。我转过头来想不通。
【问题讨论】:
标签: c# .net asp.net-mvc-4 button html-helper