Bruce
Bruce

Reputation: 2213

modalpopupextender set to multiple target control IDs?

Is it possible to tie one modalpopupextender to multiple target controls (multiple buttons)?

Thanks Behrouz

Upvotes: 2

Views: 6402

Answers (2)

Bruce
Bruce

Reputation: 2213

Good Answer, I will just add to it:

  1. For me I had to change onclick to OnClientClick:

    <asp:Button ID="btn_contact2" runat="server" 
                OnClientClick="javascript:$find('popup1').show();return false;" 
                Text="Possibilites" />
    
  2. You need to add a BehaviorID to the modalpopup:

    BehaviorID="popup1"
    

Upvotes: 2

blech
blech

Reputation: 733

I don't think you can specify multiple targets for the ModalPopupExtender. But you can call it from other controls via JavaScript by adding something like this to their onclick handler:

<act:ModalPopupExtender id="mpePopup" runat="server" BehaviorID="bePopup" ... />
<asp:Button id="btnOther" runat="server" Text="Open Dialog" OnClientClick="$find('bePopup').show();return false;" />

The key is to provide a value for "BehaviorID" in the extender control. This enables client-side access via the "$find(behaviorID)" method, from which you can ".show()" or ".hide()" the modal popup.

Upvotes: 1

Related Questions