modalpopupextender set to multiple target control IDs?
Is it possible to tie one modalpopupextender t开发者_开发技巧o multiple target controls (multiple buttons)?
Thanks Behrouz
Good Answer, I will just add to it:
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" />
You need to add a BehaviorID to the modalpopup:
BehaviorID="popup1"
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.
精彩评论