views:

162

answers:

1

Hello, I use a modalpopupextender to show a popup when the user clicks on a button.

<ajaxToolkit:ModalPopupExtender ID="mpe1" runat="server" TargetControlID="statusInfoLb" PopupControlID="statusInfoPanel" DropShadow="false"  
    OkControlID="okBtn" OnOkScript="onOk()">            
</ajaxToolkit:ModalPopupExtender>

<asp:Panel ID="statusInfoPanel" runat="server" Height="185px" Width="454px" SkinID="Panel_Notification2" DefaultButton="okBtn">

The panel has an OK-Button to dispose the popup. It is also possible to click Return to dispose the popup, because the panel has the property DefaultButton="okBtn". But this only works when the popup has the focus, which is not so from the start. How do I get the popup panel to have the focus when it shows? I would like to use jQuery.

A: 

Something along the lines of this (assuming your initial button has an id of dialogOpen) should work.

$("#dialogOpen").live('click', function(){
    $("#statusInfoPanel").focus();
})
HurnsMobile
Great. Thank you.
Jan-Frederik Carl