如何使用mvc5将局部视图作为弹出窗口加载到父视图中 [英] How to load a partial view as a popup in a parent view using mvc5
问题描述
Test.cshtml:
功能测试(){
document.getElementById(测试).showModal();}
函数测试(){
document.getElementById(" testing")。showModal();}
< img src ="〜/ images / test.png"的onclick = QUOT;测试()" />
< dialog id =" testing" style =" position:absolute;顶部:0px;左:0px; "> @ Html.ActionLink(" test"," Test"," Home")< / dialog>
Homecontroller:
公共ActionResult测试()
{
.....
返回PartialView(c);}
当我这样做时将我重定向到下一页但我想将此视图作为父视图上的弹出窗口。我也使用了@ Html.partial(Test),它创建了这个视图作为弹出窗口,但是没有执行动作意味着它没有在我的弹出窗口中显示我想要的结果。任何人都可以帮我做什么来生成这个视图作为父视图中的popoup窗口。
Test.cshtml:
function test() {
document.getElementById(testing).showModal();}
function test() {
document.getElementById("testing").showModal();}
<img src="~/images/test.png" onclick="test()" />
<dialog id="testing" style="position: absolute; top: 0px; left: 0px; ">@Html.ActionLink("test","Test","Home")</dialog>
Homecontroller:
public ActionResult Test()
{
.....
return PartialView(c);}
when i do this it redirect me to the next page but i want this view as a popup on the parent view . i have also used @Html.partial("Test") , it created this view as popup but doesnot performed the action means it is not showing the results that i want on my popup . can any one help what should i do for generating this view as popoup window in the parent view.
推荐答案
参考这篇文章,
< a href =http://www.codeproject.com/Tips/826002/Bootstrap-Modal-Dialog-Loading-Content-from-MVC-Pa> Bootstrap模态对话框 - 从MVC部分视图加载内容 [ ^ ]
-KR
Refer this article,
Bootstrap Modal Dialog - Loading Content from MVC Partial View[^]
-KR
这篇关于如何使用mvc5将局部视图作为弹出窗口加载到父视图中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!