嗨,我正在尝试使用图像按钮将值传递给模型,但它说我只是发送任何东西都没有任何帮助。
我用普通的输入按钮让它工作
<input type="submit" name="Vote" value="6" />
但不是图像。
<input type="image" src="..urlpath" name="Vote" value="6"/>
<button type="submit" name="Vote" value="6"> 6 <img src="...urlpath" /></button>
如果你能帮助我,那将是非常感谢
控制器
public ActionResult PlanVote()
{
return View();
}
[HttpPost]
public ActionResult PlanVote(int vote)
{
PlanModel myModel = PlanModel.Instance;
myModel.Vote(vote);
if (PlanModel.Instance.currentstate == PlanState.displaying)
{
return RedirectToAction("Index", "Plan");
}
else
{
return RedirectToAction("Waiting", "Plan");
}
}
模型
public void Vote(int Votes)
{
ivote.Add(Votes);
if (countVotes >= iCount)
{
currentstate = PlanState.displaying;
}
}