Bootstrap Modal无法正常工作

时间:2015-05-27 05:13:08

标签: asp.net-mvc-4 bootstrap-modal

此代码的数据正常运行。我现在的问题是模态没有正确显示。似乎引导程序的Modal功能不起作用,数据只是在页面的顶部弹出。

这是我的观点:

<a data-toggle="modal" data-target="#edit-@id_modal" href="@Url.Action("edit", "Switch", new { id = item.switches_info_id })" class="fa fa-edit fa-lg"></a>&nbsp;&nbsp;||&nbsp;&nbsp;
<a data-toggle="modal" data-target="#edit-@id_modal" href="@Url.Action("Details", "Switch", new { id = item.switches_info_id })" class="fa fa-plus-square fa-lg"></a>&nbsp;&nbsp;||&nbsp;&nbsp;
<a data-toggle="modal" data-target="#edit-@id_modal" href="@Url.Action("Delete", "Switch", new { id = item.switches_info_id })" class="fa fa-trash-o fa-lg"></a>

我的代码显示模态:

<div class="modal fade" id="edit-@id_modal">
     <div class="modal-dialog">
          <div class="modal-content">
               <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">Switch Info</h4>
               </div>
                <div class="modal-body">
                </div>
                <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                 </div>
            </div>
       </div>
</div>

我的代码显示信息:

@using (Html.BeginForm("Edit", "Switch", FormMethod.Post)) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)   
@Html.Hidden("switches_info_id",Model.switches_info_id)
@Html.Hidden("switch_transactions_id",Model.switch_transactions_id) 
@Html.Hidden("sw_trans_type",Model.sw_trans_type)
@Html.Hidden("sw_trans_by",Model.sw_trans_by)
@Html.Hidden("sw_trans_date",Model.sw_trans_date)
@Html.Hidden("sw_history_status",Model.sw_history_status)
@Html.HiddenFor(model => model.switches_info_id)
@Html.HiddenFor(model => model.created_by) 
@Html.HiddenFor(model => model.created_date)
<table class="edit-table">
    <caption id="pr-table"><b> EDIT INFORMATION </b></caption>
    <tr>
        <td class="i_name">Brand: </td><td class="td">@Html.DropDownList("brand_id")</td>
        <td class="i_name">Model:</td> <td class="td"> @Html.DropDownList("model_id")</td>
        <td class="i_name">Supplier:</td><td class="td">@Html.DropDownList("sw_suppliers_id", String.Empty)</td>
    </tr>
    <tr>
        <td class="i_name">No of Ports: </td><td class="td">@Html.EditorFor(model => model.sw_no_of_ports)</td>
        <td class="i_name">Serial Number:</td><td class="td">@Html.EditorFor(model => model.sw_serial_no)</td>
    </tr>

    <tr>
        <td class="i_name">Mac Address:</td> <td class="td"> @Html.EditorFor(model => model.sw_mac_address)</td>
        <td class="i_name">IP Address: </td><td class="td">@Html.Editor("sw_ip_address")</td>

    </tr>
    <tr>
        <td class="i_name">Node Name:</td> <td class="td"> @Html.Editor("sw_node_name")</td>
        <td class="i_name">Location: </td><td class="td">@Html.Editor("sw_location")</td>

    </tr>
    <tr>
        <td class="i_name">Date Delivered:</td> <td class="td"> @Html.EditorFor(model => model.sw_delivery_date)</td>
        <td class="i_name">End of Warranty: </td><td class="td">@Html.EditorFor(model => model.sw_warranty_end)</td>
    </tr>
    <tr>
        <td class="i_name">POE:</td> <td class="td"> @Html.EditorFor(model => model.sw_poe)</td>
        <td class="i_name">Active?</td><td class="td">@Html.EditorFor(model => model.is_active)</td>
    </tr>
    <tr>
        <td class="i_name">Remarks: </td><td class="td">@Html.Editor("sw_remarks")</td>
    </tr>

</table>

<p class="save">
     @Html.ActionLink("Cancel", "Index", "Switch", new { @class="button"})
     <input type="submit" value="Save" />
</p>

}

这是输出:

enter image description here

请帮我这个。非常感谢。

0 个答案:

没有答案