简体   繁体   English

页面加载事件不会在 JavaScript 模态弹出窗口中触发

[英]Page Load event does not fire inside JavaScript modal pop up

I have an aspx page which I am showing inside a JavaScript pop up like this.我有一个 aspx 页面,我在这样的 JavaScript 弹出窗口中显示它。

When client side button clicked in the parent page, JavaScript fires to display the pop up.当在父页面中单击客户端按钮时,JavaScript 会触发以显示弹出窗口。

function shoeColOptions() {

    var saveColPref = document.getElementById("hdnSaveColPref").value;
    var colResult = window.showModalDialog("ColumnPreference.aspx?prefPattern=" + saveColPref, "Select Columns", 'center:yes; dialogWidth:600px; dialogHeight:250px; location:no; edge:raised; help:no; resizable:no; scroll:no; status:no; statusbar:no; toolbar:no; menubar:no; addressbar:no; titlebar:no;');

    if ((colResult != "") && (colResult != "undefined")) {

        var hdnCol = document.getElementById("hdnColPref");
        hdnCol.value = colResult;
        return true;
    }
    else {
        return false;
    }        

}

There is some code to populate few drop down lists in the Page_Load event in the aspx page.有一些代码可以在 aspx 页面的Page_Load事件中填充几个下拉列表。

The problem is, the page load event in the ColumnPreference.aspx page fires only the first time.问题是, ColumnPreference.aspx页面中的页面加载事件仅在第一次触发。 If I close the pop up and open it again, the Page_Load event does not fire, hence the drop down lists in the pop up is not updated.如果我关闭弹出窗口并再次打开它,Page_Load 事件不会触发,因此弹出窗口中的下拉列表不会更新。

What could be the problem?可能是什么问题呢?

For your understanding Please note that PageLoad() will trigger only when the page post back.为了您的理解,请注意PageLoad()仅在页面回发时触发。 If your button click event not post back the page then Pageload() method not to be call.如果您的按钮单击事件未回发页面,则不会调用Pageload()方法。

Please share your PageLoad() code So that I can improve my answer.请分享您的PageLoad()代码,以便我改进答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM