页面上的回叫问题 [英] Call Back Problem on page unload

查看:110
本文介绍了页面上的回叫问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个母版页和一个带有从母版继承的网格的默认页.当网格正在编辑时,我单击链接"按钮进入另一页(在母版页"上),我需要一条消息.
保存?-是,否"我已经编写了一个J-Script函数来进行页面卸载

I have a Master page and a default page with grid which inherits from Master. When Grid is editing and I click Link Button for another page (on Master page) I need a message.
"Save? - Yes, No" I have written a J-Script function for page unload

window.onbeforeunload = CheckUpdate;
function CheckUpdate() {
  if ("some requirements") {
    if (ASPxGridView1.cpIsEditing == 'True') {
      if (confirm("Save Changes?")) {
        ASPxGridView1.PerformCallback('-1');
      }
      else {
        ASPxGridView1.PerformCallback('-2');
      }
    }
  }
}


它工作正常,但仅在调试模式下,而在发布模式下却没有调试不起作用(有时无法工作-有时无法调用).


It works fine but just in debug mode, in release mode without debugging that doesn''t work( sometimes it works sometimes not - Call Back doesn''t call).

推荐答案

此事件在处理方式上不是很可靠.如果您要在调用之前保存数据,请确认这实际上会有所不同.

看一下我认为可能会有所帮助的这些链接,尤其是第二个和第三个链接:
http://www.4guysfromrolla.com/webtech/100604-1.shtml [ ^ ]

http://www.4guysfromrolla.com/articles/101304-1.aspx [ ^ ]

http://www.4guysfromrolla.com/articles/042005-1.aspx [ ^ ]

祝你好运!
This event is not very reliable in how it is handled. If you would save the data before calling confirm that would actually make a difference.

Have a look at these links that I think might help, especially the second and third link:
http://www.4guysfromrolla.com/webtech/100604-1.shtml[^]

http://www.4guysfromrolla.com/articles/101304-1.aspx[^]

http://www.4guysfromrolla.com/articles/042005-1.aspx[^]

Good luck!


这篇关于页面上的回叫问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆