C# 引导模式:模式体中显示的部分视图
我试图在引导模型中加载局部视图。因为我在父页面中有一个现有表单,而在部分视图中有另一个表单。我不能决定把表格放在一页纸上,因为那样的话,表格中就会有一个表格 下面是父页面中的我的复选框,选中该复选框后将显示“模型”对话框:C# 引导模式:模式体中显示的部分视图,c#,jquery,bootstrap-modal,asp.net-mvc-partialview,C#,Jquery,Bootstrap Modal,Asp.net Mvc Partialview,我试图在引导模型中加载局部视图。因为我在父页面中有一个现有表单,而在部分视图中有另一个表单。我不能决定把表格放在一页纸上,因为那样的话,表格中就会有一个表格 下面是父页面中的我的复选框,选中该复选框后将显示“模型”对话框: <input type="checkbox" name="inputNewBornKMC" value="inputNewBornKMC" id="inputNewBornKMCCheckbox"> New Born 将在控制器中调用操作以显示局部视图: pu
<input type="checkbox" name="inputNewBornKMC" value="inputNewBornKMC" id="inputNewBornKMCCheckbox"> New Born
将在控制器中调用操作以显示局部视图:
public ActionResult AddPartialRegistration()
{
return PartialView("_PartialRegistration");
}
在部分注册页面中:
<div class="modal-body">
<form class="form-horizontal" id="frmSearchMother" role="form" >
Mother's MRN
<input type="text" class="form-control input-sm" id="popupMotherMRN" name="popupMotherMRN" />
IC/ID No
<input type="text" class="form-control input-sm" id="popupICNo" name="popupICNo" />
Mother's Name
<input type="text" class="form-control input-sm" id="popupMotherName" name="popupMotherName" />
<button type="button" class="btn btn-default" id="SearchMother" >Search</button>
</form>
<br />
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="LoadMotherDetailsTable">
<thead>
<tr>
<th>No.</th>
<th>Mother's MRN</th>
<th>Mother's IC No</th>
<th>Mother's Name</th>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
母亲的MRN
身份证号码
母亲的名字
搜索
不
母亲的MRN
母亲的身份证号码
母亲的名字
我已经尝试过很多方法,人们应用了部分观点,但没有一种有效。我不确定如何将局部视图插入模态对话框的模态体中。选中复选框时可以显示此对话框,但我不确定如何在模态体中加载局部视图
任何帮助都将不胜感激。这是我的第一个答案,所以不要期望太多 我想说的是,注入局部视图的最佳方式是您正在尝试的方式 我认为您可以调用AJAX并通过控制器返回部分视图数据。 这是一段取自我编写的用例的代码:
function showVideo(e) {
alert('#' + $(e).attr("id"));
$.ajax({
url: '/Games/_GameModal/' + $(e).attr("id"),
dataType: 'html',
success: function (data) {
alert('#' + $(e).attr("id"));
$('#deleteConfirmation').html(data);
$('#deleteConfirmation').modal();
}
});
}
这是我的部分视图cshtml:
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-
hidden="true">×</button>
<h2 class="modal-title text-center">@Model.gameName</h2>
<h4 class="text-center">By @Model.publisher</h4>
<h5 class="text-center">Content Rating: @Model.Contentrating</h5>
</div>
<div class="modal-body">
<h4 class="text-center">Trailer</h4>
<iframe width="560" height="315" src="@Model.trailerLink"
frameborder="0" allowfullscreen></iframe>
<h4 class="text-center">Description</h4>
<p>@Model.description</p>
</div>
</div>
&时代;
@Model.gameName
作者@Model.publisher
内容评级:@Model.Contentrating
拖车
描述
@模型描述
这是我正在注入的容器:
<div class="modal fade" id="deleteConfirmation" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
</div>
如果要注入模态体,可以将“#deleteConfirmation”替换为模态体的you div的id,并将HTML数据注入其中
我希望这是有帮助的,如果没有,我很抱歉。只是想帮忙
谢谢,
Narendran P无论如何,感谢您的好意帮助:)我不太明白aria labelledby的功能是什么?这很重要吗?如果你想让视力残疾的人使用屏幕阅读器,并且知道你的页面上发生了什么,这很重要
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-
hidden="true">×</button>
<h2 class="modal-title text-center">@Model.gameName</h2>
<h4 class="text-center">By @Model.publisher</h4>
<h5 class="text-center">Content Rating: @Model.Contentrating</h5>
</div>
<div class="modal-body">
<h4 class="text-center">Trailer</h4>
<iframe width="560" height="315" src="@Model.trailerLink"
frameborder="0" allowfullscreen></iframe>
<h4 class="text-center">Description</h4>
<p>@Model.description</p>
</div>
</div>
<div class="modal fade" id="deleteConfirmation" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
</div>