如何在弹出窗口中制作弹出窗口

时间:2017-05-29 11:12:11

标签: jquery asp.net-mvc razor popup bootstrap-modal

我有一个主页,这是一个普通的视图(MainParent.cshtml)..它有链接打开PopupParent.cshtml这是一个弹出窗口...这又有链接打开另一个子弹出...我的代码工作第一次完全没问题。但是当我关闭子弹出窗口并单击父弹出窗口时...它转到我的MainParent的GET方法

定制/ CRMDashboard.js

BDdashboard: function (prospectid, stage, fromdate, toodate) {
    if (prospectid > 0 && prospectid != undefined && prospectid != "") {
        $('#followupModal2').html("");
        $.get(CRMDashboard.BDdashboardUrl, { prospectid: prospectid, stage: stage, fromdate: fromdate, toodate: toodate }, function (data) {
            if (data != null) {                                       
                $('#followupModal2').html(data);
            }
        });
    }
},

BDdashboardAbout: function (userid, till, fromdate, toodate) {
    if (userid > 0 && userid != undefined && userid != "") {
        $('#followupModal').html("");
        $.get(CRMDashboard.BDdashboardAboutUrl, { userid: userid, till: till, fromdate: fromdate, toodate: toodate }, function (data) {
            if (data != null) {
                $('#followupModal').html(data);                    
            }
        });

    }
},

MainParent.cshtml

<td><a href="#followupModal" data-toggle="modal" title="BD Dashboard" onclick="CRMDashboard.BDdashboardAbout('@item.userid', '1', '@Model.fromdate', '@Model.toodate')">@item.addedthismonth</a></td>

<div id="followupModal" class="modal fade bs-modal-lg">
</div>
<script type="text/javascript">
$(window).on("load", function () {
   CRMDashboard.BDdashboardAboutUrl = '@Url.Content("~/BDDashboard/About")';
  });
</script>
<script src="@Url.Script("Custom/CRMDashboard.js")" type="text/javascript">
</script>

Popuparent.cshtml

<td><a href="#followupModal2" data-toggle="modal" title="Click to view" onclick="CRMDashboard.BDdashboard('@item.prospectid','@Model.stage', '@Model.fromdate', '@Model.toodate')">View</a></td>

<div id="followupModal2" class="modal fade bs-modal-lg">
</div>               

<script src="@Url.Script("Custom/CRMDashboard.js")" type="text/javascript">
</script>


<script type="text/javascript" language="javascript">
 $(document).ready(function () {
    CRMDashboard.BDdashboardUrl = '@Url.Content("~/BDDashboard/Contact")';
        });
 </script>

Popupchild.cshtml

 <td>Data</td>

1 个答案:

答案 0 :(得分:0)

我是&#34;使用$(文件).ready(fucntion())&#34;在我看来显示日历, 因此,它每次都进入我的MainParent的GET方法

<script type="text/javascript">
$(document).ready(function () {
    $('#fdate').datepicker({ dateFormat: 'dd-mm-yy', changeMonth: true, 
changeYear: true });
});
</script>