加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 使用ModalPopupExtender而不必设置TargetControlID?

发布时间:2020-12-16 00:35:37 所属栏目:asp.Net 来源:网络整理
导读:我想在我的asp.net页面中使用一个modalpopupextender来显示子表单。但它只能在具体条件下显示。这些条件由一段JavaScript代码确定。 所以,最重要的是,模态弹出窗口不必显示在按钮上。但是,如果我将属性TargetControlID为空我得到以下异常: The TargetCon
我想在我的asp.net页面中使用一个modalpopupextender来显示子表单。但它只能在具体条件下显示。这些条件由一段JavaScript代码确定。

所以,最重要的是,模态弹出窗口不必显示在按钮上。但是,如果我将属性TargetControlID为空我得到以下异常:

The TargetControlID of ‘ModalPopupExtender1’ is not valid. The value cannot be null or empty.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:
System.InvalidOperationException: The
TargetControlID of
‘ModalPopupExtender1’ is
not valid. The value cannot be null or
empty.

我只是将TargetControlID设置为隐藏的按钮,或者是有更加体面的选择吗?

解决方法

将TargetControlID设置为隐藏的按钮(display:none;)是我所知道的最好的方法。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读