Asp.net mvc 3 使用按钮而不是文本框传递数据asp.net mvc3

Asp.net mvc 3 使用按钮而不是文本框传递数据asp.net mvc3,asp.net-mvc-3,button,Asp.net Mvc 3,Button,大家好,我正在创建一个项目,其中所有用户都在使用singleton设计模式运行同一个实例。当用户在文本框中键入值时。然后,它将等待其他人键入值,然后显示结果。我的问题是,这可以通过向模型发送值的按钮而不是文本框来实现。e、 g.多个按钮,每个按钮发送不同的值 这是我的密码 看法 模型 我对MVC还是一个新手,如果有任何帮助,我都会非常感激的。只需删除独立提交按钮,每次投票使用一次提交即可 @using (Html.BeginForm()) { <fieldset> <d

大家好,我正在创建一个项目,其中所有用户都在使用singleton设计模式运行同一个实例。当用户在文本框中键入值时。然后,它将等待其他人键入值,然后显示结果。我的问题是,这可以通过向模型发送值的按钮而不是文本框来实现。e、 g.多个按钮,每个按钮发送不同的值

这是我的密码

看法

模型


我对MVC还是一个新手,如果有任何帮助,我都会非常感激的。只需删除独立提交按钮,每次投票使用一次提交即可

@using (Html.BeginForm())
{
<fieldset>
    <div class="editor-label">
       What is you vote?
    </div>
    <div class="editor-field">
        <input type="submit" name="vote" value="1" />
        <input type="submit" name="vote" value="2" />
        <input type="submit" name="vote" value="3" />
    </div>
</fieldset>
}
@使用(Html.BeginForm())
{
你投什么票?
}
         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)
    {

        countVotes++;
        ivote.Add(Votes);

        if (countVotes >= iCount)
        {
            currentstate = PlanState.displaying;
        }


    }
@using (Html.BeginForm())
{
<fieldset>
    <div class="editor-label">
       What is you vote?
    </div>
    <div class="editor-field">
        <input type="submit" name="vote" value="1" />
        <input type="submit" name="vote" value="2" />
        <input type="submit" name="vote" value="3" />
    </div>
</fieldset>
}