控制器...
[HttpPost]
public virtual ActionResult PickAColour(ColourModel model,
string imgbtn, string returnUrl) {
和视图...
@using (Html.BeginForm(MVC.Home.PickAColour(Model,"",(string)ViewBag.ReturnUrl))) {
@Html.LabelFor(m => m.SomeProperty)
@Html.TextBoxFor(m => m.SomeProperty)
...
...
<p>Now pick a colour</p>
<input type="image" name="imgbtn" src="@Links.Content.Images.A_png" value="A"/>
<input type="image" name="imgbtn" src="@Links.Content.Images.B_png" value="B"/>
<input type="image" name="imgbtn" src="@Links.Content.Images.C_png" value="C"/>
<input type="image" name="imgbtn" src="@Links.Content.Images.D_png" value="D"/>
<input type="image" name="imgbtn" src="@Links.Content.Images.E_png" value="E"/>
<input type="image" name="imgbtn" src="@Links.Content.Images.F_png" value="F"/>
}
现在,这不起作用,因为我没有将 imgbtn 参数传递给方法。我不知道正确的方法是什么?