How to specify javascript to run when ModalPopupExtender is shown
hmmm... I'm pretty sure that there's a shown event for the MPE... this is off the top of my head, but I think you can add an event handler to the shown event on page_load
function pageLoad(){ var popup = $find('ModalPopupClientID'); popup.add_shown(SetFocus);}function SetFocus(){ $get('TriggerClientId').focus();}
i'm not sure tho if this will help you with calling it from the server side tho
Here's a simple way to do it in markup:
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender2" runat="server" TargetControlID="lnk_OpenGame" PopupControlID="Panel1" BehaviorID="SilverPracticeBehaviorID" > <Animations> <OnShown> <ScriptAction Script="InitializeGame();" /> </OnShown> </Animations> </ajaxToolkit:ModalPopupExtender>
You should use the BehaviorID value mpeBID
of your ModalPopupExtender.
function pageLoad() { $find('mpeBID').add_shown(HideMediaPlayer);}function HideMediaPlayer() { var divMovie = $get('<%=divMovie.ClientID%>'); divMovie.style.display = "none";}