这是partialView
@model IEnumerable<NeoCBSModel.MembersList>
<div id="membersModal">
<h4>Members List</h4>
<table class="table table-responsive dataTable">
<thead>
<tr>
<th></th>
<th>Saving Ac No</th>
<th>Member Name</th>
<th>Saving Product</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td><a id="select" href="#" onclick="closeModal();">Select</a></td>
<td>@item.saving_account_no</td>
<td>@item.memberName</td>
<td>@item.product_name</td>
</tr>
}
</tbody>
</table>
<script type="text/javascript">
function closeModal() {
$("#membersModal").hide();
}
$(".dataTable").DataTable();
我将上面的partialView显示为模态对话框。以下代码块用于另一个视图。我是通过以下方式做到的:
<script type="text/javascript">
$('#memberName').focusin(function () {
//$('#membermodal').modal('show');
_dialog = $("#members").dialog({
autoOpen: true,
position: { my: "center", at: "top+100", of: window },
width: 800,
resizable: false,
modal: true,
open: function () {
$(this).load('@Url.Action("GetMemberList","SavingTranscation")');
},
close: function () {
closeModal("#members");
}
});
})
</script>
在此之后,它会在模态上方显示一个关闭按钮。我只是想摆脱它。并且“选择”链接必须将@item.saving_account_no
发送到父视图。