使用ModalPopupExtender而不必设置的TargetControlID? [英] Use ModalPopupExtender without having to set TargetControlID?

查看:420
本文介绍了使用ModalPopupExtender而不必设置的TargetControlID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用modalpopupextender在我的asp.net页面来显示子表单。但它只有上显示的特定条件。在一段JavaScript代码code的确定这些条件。

I'd like to use a modalpopupextender in my asp.net page to show a sub form. But it only has to show on specific conditions. Those conditions are determined in a piece of javascript code.

因此​​,最重要的是,模式弹出不必显示在按钮点击。但是,如果我离开了财产的TargetControlID空的,我得到了以下异常:

So, most importantly, the modal popup doesn't have to show on a button click. However, if I leave the property TargetControlID empty I get the following exception:

ModalPopupExtender1'的的TargetControlID无效。该值不能为null或空。
  说明:执行当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细信息的堆栈跟踪以及它起源于code。

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.

异常详细信息:
  System.InvalidOperationException:该
  中的TargetControlID
  ModalPopupExtender1'是
  无效。值不能为空或
  空的。

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

我只是有的TargetControlID一个隐藏按键还是有ASLO更体面的选择吗?

Do I just have the TargetControlID to an hidden button or is there aslo a more decent option?

推荐答案

设置的TargetControlID到一个隐藏按钮(显示:无;)是最好的方法,据我所知

Setting the TargetControlID to a hidden button(display:none;) is the best way as far as I know.

这篇关于使用ModalPopupExtender而不必设置的TargetControlID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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