如何用asp mvc制作模态?

时间:2015-07-06 18:49:55

标签: asp.net-mvc modal-dialog

我有一个问题,我在我的视图中有一个表单,这个表单包含一个列表,这个列表包含四个属性,供应商,应用程序,产品和值,这4个我们只显示两个(如代码中所示)喜欢在模态产品中显示和订单的价值,列表显示在同一位置已经有这样的数据,如何通过我的按钮动作显示该数据,该按钮具有动作“getFornecedor”(此动作具有尚未实现,我不知道是否有必要,因为元素在列表中的位置相同)

查看

@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">
                                    <a href="@Url.Action("getFornecedor", "MyController")" class="btn btn-xs btn-primary">
                                        <i class="glyphicon glyphicon-phone-alt"></i>
                                    </a>
                                    <a href="@Url.Action("sendEmail", "MyController")" class="btn btn-xs btn-primary">
                                        <i class="glyphicon glyphicon-envelope"></i>
                                    </a>
                                </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>

1 个答案:

答案 0 :(得分:0)

MVC没有动态模式..(比如网页表单中的控件)我建议您使用第三方库,可能类似于jquery UI ..您可以在这里看到示例:https://jqueryui.com/dialog/ 您只需要客户端事件来显示模态对话框。在该容器中,您可以放置​​所需的任何数据。