使用 ModalPopupExtender 和 UpdatePanel 应注意的问题

项目中使用 ASP.NET Ajax,也使用了 AjaxToolkit 中的 ModalPopupExtender 控件。

在开发中遇到了这个错误信息:Sys.InvalidOperationException: Handler was not added through the Sys.UI.domEvent.addHandler method。通过 Google 找到了这个帖子,按照老外的方法搞定了该问题,原文引用如下:

This issue seems to stem from the fact that the ModalPopupExtender is not expecting to have the Ok and Cancel controls in the update panel.  Normally, you cannot define and Code Behind for these Buttons click events.  So when you Click on these buttons, and they post back to the server, something is broken between the ModalPopupExtender and the buttons.  By defining dummy buttons to take their place, it will make the web page stop throwing the javascript exception.  Even though the buttons are invisible, and do not do anything.

I hope this helps.

用一句来说:不要将 ModalPopupExtender 控件的 OK 和 Cancel 控件放在 UpdatePanel 中。

转载于:https://www.cnblogs.com/gucsnet/archive/2008/11/18/1335699.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值