How to specify javascript to run when ModalPopupExtender is shown

前端 未结 8 645
有刺的猬
有刺的猬 2020-12-28 13:15

The ASP.NET AJAX ModalPopupExtender has OnCancelScript and OnOkScript properties, but it doesn\'t seem to have an OnShowScri

相关标签:
8条回答
  • 2020-12-28 13:52

    If you are using a button or hyperlink or something to trigger the popup to show, could you also add an additional handler to the onClick event of the trigger which should still fire the modal popup and run the javascript at the same time?

    0 讨论(0)
  • 2020-12-28 13:53

    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

    0 讨论(0)
提交回复
热议问题