views:

727

answers:

3

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.

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:

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.

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

Thanks.

A: 

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

Mike
A: 

The targetcontrolId can not be null or empty. Setting it to a button 'Button1' that i hide was not an option since hidden controls aren't rendered. Even hiding the control in de Page_Load did not work.

Adding a style 'display:none' did the trick! Thanx

Eelko