Asp.net mvc 如何使用表单中的按钮调用输入以外的事件?

Asp.net mvc 如何使用表单中的按钮调用输入以外的事件?,asp.net-mvc,view,Asp.net Mvc,View,我有一个问题,我有一个表单中的列表,在这个列表的一列中我有两个按钮,但即使我在控制器中为它们指定了一个操作,它们仍会继续调用提交操作,我想知道我如何调用不同的操作,这就是为什么我需要它?将来这些按钮可以打开一些模态,隐藏这个列表数据可以帮助我吗?谢谢 我的看法是: @model Test.Models.Order <head> <meta charset="utf-8" /> <title>Teste</title> &l

我有一个问题,我有一个表单中的列表,在这个列表的一列中我有两个按钮,但即使我在控制器中为它们指定了一个操作,它们仍会继续调用提交操作,我想知道我如何调用不同的操作,这就是为什么我需要它?将来这些按钮可以打开一些模态,隐藏这个列表数据可以帮助我吗?谢谢

我的看法是:

@model Test.Models.Order

<head>
    <meta charset="utf-8" />
    <title>Teste</title>
    <meta name="viewport" content="width=device-width" />
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <link rel="stylesheet" href="/resources/demos/style.css">
    <link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" href="http://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css">
    <script type="text/javascript" src="http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
    <script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>

    @Styles.Render("~/Content/bootstrap.css")
    @Scripts.Render("~/bundles/modernizr")
    <style>
        th {
            height: 10px;
        }
    </style>
    </head>
<body>
        <div id="divbody">
    <nav class="navbar navbar-inverse">
    </nav>
            @using (Html.BeginForm("Save", "Cab", FormMethod.Post))
            {
                <div class="table-responsive" id="table">
                    <table id="myTable" class="table table-striped" cellspacing="0">
                        <thead style="position:static">
                            <tr>
                                <th style="font-size:10px">SELECT</th>
                                <th style="font-size:10px">CONTACT</th>
                                <th></th>
                                <th style="font-size:10px">SUPPLY</th>
                                <th style="font-size:10px">ORDER</th>
                            </tr>
                        </thead>
                        @for (int i = 0; i < Model.listOrder.Count(); i++)
                        {
                            <tr>
                                <td align="center" height="2px">@Html.CheckBoxFor(m => m.listOrder[i].isEdit, new { @onclick = "habilit(" + i + ")", @id = "c" + i })</td>
                                <td colspan="2">
                                    <button disabled="" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-phone-alt"></i></button>
                                    <button disabled="" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-envelope"></i></button>
                                </td>
                                <td height="2px"> @Html.TextBoxFor(m => m.listOrder[i].supply, new { @readonly = "readonly", @size = "18px", @class = "form-controlSupply" }) </td>
                                <td height="2px"> @Html.TextBoxFor(m => m.listOrder[i].order, new { @readonly = "readonly", @size = "75px", @class = "form-controlOrder" }) </td>
                                <td></td>
                            </tr>
                        }
                    </table>
                </div>
                <br />
                <input type="submit" value="Salve" id="btn" disabled="disabled" class="btn btn-small btn-primary" />
            }
    </div>
 </body>
</html>
@model Test.Models.Order
睾丸
@style.Render(“~/Content/bootstrap.css”)
@Scripts.Render(“~/bundles/modernizer”)
th{
高度:10px;
}
@使用(Html.BeginForm(“Save”、“Cab”、FormMethod.Post))
{
挑选
接触
供给
命令
@对于(int i=0;im.listOrder[i].isEdit,新的{@onclick=“habilit”(+i+)”,@id=“c”+i})
@Html.TextBoxFor(m=>m.listOrder[i].supply,新{@readonly=“readonly”、@size=“18px”、@class=“form controlSupply”})
@Html.TextBoxFor(m=>m.listOrder[i].order,新{@readonly=“readonly”、@size=“75px”、@class=“form controlOrder”})
}

}
如果您希望按钮只是一个按钮,请使用

<button type="button" disabled="" class="btn btn-xs btn-primary">
    <i class="glyphicon glyphicon-phone-alt"></i>
</button>
试试

<a href="@Url.Action("Index", "Home")" class="btn btn-xs btn-primary">
    <i class="glyphicon glyphicon-phone-alt"></i>
</a>