一个 Jquery 对话框可以打开另一个 Jquery 对话框吗?

发布于 2024-12-23 04:48:07 字数 3799 浏览 2 评论 0原文

我想打开一个部分视图作为 JQuery 对话框,当我单击链接时,在已打开的对话框上打开另一个 Jquery 对话框。

我可以这样做吗?如果可能的话,我怎样才能实现这一目标?

编辑1:

第一个视图

@model AuctionWebProject.Areas.Admin.Models.CategoryModel  
@{  
    ViewBag.Title = "Edit Category";  
    Layout = "~/Views/Shared/_Layout.cshtml";  
}  
<!DOCTYPE html>  
<html>  
<head>  
    <title>EditCategory</title>  
</head>  
<body>  
    <script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.16.min.js")" type="text/javascript"></script>  
    <script type="text/javascript">  
        function ShowXsdEditor() {  
            $("#xsdEditor").dialog("open");  
        }  
    </script>  
    @using (Html.BeginForm())  
    {  
        @Html.ValidationSummary(true)  
        <fieldset>  
            <legend>CategoryModel</legend>  
            @Html.HiddenFor(model => model.Id)  
            <div class="editor-label">  
                @Html.LabelFor(model => model.Name)  
            </div>  
            <div class="editor-field">  
                @Html.EditorFor(model => model.Name)  
                @Html.ValidationMessageFor(model => model.Name)  
            </div>  
            <div class="editor-label">  
                @Html.LabelFor(model => model.Date)  
            </div>  
            <div class="editor-field">  
                @Html.EditorFor(model => model.Date)  
                @Html.ValidationMessageFor(model => model.Date)  
            </div>  
            <div class="editor-label">  
                @Html.LabelFor(model => model.Xsd)  
            </div>  
            <div class="editor-field">  
                @Html.TextAreaFor(model => model.Xsd, new { disabled = "disabled" })  
                @Html.ValidationMessageFor(model => model.Xsd)  
                <a href="javascript:void(0)" onclick="ShowXsdEditor();">Xsd Editor</a>  
            </div>  
            <p>  
                <input type="submit" value="Save" />  
            </p>  
        </fieldset>  
    }  
    <div>  
        @Html.ActionLink("Back to List", "Index")  
    </div>  
    @Html.Partial("XsdEditor", Model)  
</body>  
</html> 

第二个视图

    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript">  </script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>  
<div id="xsdEditor" style="display: none;">  
     <a href="javascript:void(0)" onclick="ShowDialog();">Add new element</a>  
     <div id="elementList">  
     </div>  
</div>  
@Html.Partial("AddXSElement", new AuctionWebProject.Areas.Admin.Models.XSElementModel())  
<script type="text/javascript">  
    $(document).ready(function () {  
        $("#xsdEditor").dialog({  
            autoOpen: false, width: 400, height: 330, modal: true, title:'XSD Editor'  
        });  
    });  

    function ShowDialog() {  
        debugger;  
        $("#addXSElement").dialog("open");  
    }  
</script>

我使用JQuery v 1.6.2和Jquery Ui 1.8.12

I want to open a partial view as a JQuery dialog that when I click a link to open another Jquery dialog over the one that is already open.

Can I do that? If it is possible, how can I achieve that?

Edit 1:

First view

@model AuctionWebProject.Areas.Admin.Models.CategoryModel  
@{  
    ViewBag.Title = "Edit Category";  
    Layout = "~/Views/Shared/_Layout.cshtml";  
}  
<!DOCTYPE html>  
<html>  
<head>  
    <title>EditCategory</title>  
</head>  
<body>  
    <script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>  
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.16.min.js")" type="text/javascript"></script>  
    <script type="text/javascript">  
        function ShowXsdEditor() {  
            $("#xsdEditor").dialog("open");  
        }  
    </script>  
    @using (Html.BeginForm())  
    {  
        @Html.ValidationSummary(true)  
        <fieldset>  
            <legend>CategoryModel</legend>  
            @Html.HiddenFor(model => model.Id)  
            <div class="editor-label">  
                @Html.LabelFor(model => model.Name)  
            </div>  
            <div class="editor-field">  
                @Html.EditorFor(model => model.Name)  
                @Html.ValidationMessageFor(model => model.Name)  
            </div>  
            <div class="editor-label">  
                @Html.LabelFor(model => model.Date)  
            </div>  
            <div class="editor-field">  
                @Html.EditorFor(model => model.Date)  
                @Html.ValidationMessageFor(model => model.Date)  
            </div>  
            <div class="editor-label">  
                @Html.LabelFor(model => model.Xsd)  
            </div>  
            <div class="editor-field">  
                @Html.TextAreaFor(model => model.Xsd, new { disabled = "disabled" })  
                @Html.ValidationMessageFor(model => model.Xsd)  
                <a href="javascript:void(0)" onclick="ShowXsdEditor();">Xsd Editor</a>  
            </div>  
            <p>  
                <input type="submit" value="Save" />  
            </p>  
        </fieldset>  
    }  
    <div>  
        @Html.ActionLink("Back to List", "Index")  
    </div>  
    @Html.Partial("XsdEditor", Model)  
</body>  
</html> 

Second view

    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript">  </script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>  
<div id="xsdEditor" style="display: none;">  
     <a href="javascript:void(0)" onclick="ShowDialog();">Add new element</a>  
     <div id="elementList">  
     </div>  
</div>  
@Html.Partial("AddXSElement", new AuctionWebProject.Areas.Admin.Models.XSElementModel())  
<script type="text/javascript">  
    $(document).ready(function () {  
        $("#xsdEditor").dialog({  
            autoOpen: false, width: 400, height: 330, modal: true, title:'XSD Editor'  
        });  
    });  

    function ShowDialog() {  
        debugger;  
        $("#addXSElement").dialog("open");  
    }  
</script>

I use JQuery v 1.6.2 and Jquery Ui 1.8.12

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

调妓 2024-12-30 04:48:07

根据我创建的小提琴,它将毫无问题地显示。

According to the fiddle I have created, it will show up with no problem.

多情出卖 2024-12-30 04:48:07

发现问题了,文档中准备好的JQuery函数似乎没有正常工作。
对对话框java脚本重新排序后,问题消失了。

Found the problem, it seems that the JQuery function that was in the document ready didn't work as it should.
After reordering the dialogs java script, the problem disappeared.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文