views:

1333

answers:

3

Hi, I'm using the ModalPopupExtender control from the AJAX toolkit. This control extends a panel which contains a CreateUserWizard control. However, the validation of the CreateUserWizard control causes a postback to the server, which closes the popup. I'd like the popup to remain open, even after the postback. From what I can gather, I should be using an UpdatePanel. However, I can't seem to get it working. The reason it's being quite tricky is because the structure should be :

ModalPopupExtender
<Panel>
<UpdatePanel>
<ContentTemplate>...</ContentTemplate>
</UpdatePanel>
</Panel>

I can't follow this structure because the ModalPopupExtender relies on a button which is contained within the CreateUserWizard control. Therefore, it has to be added within the <asp:CreateUserWizard> </asp:CreateUserWizard> tags. I would like the submit button, built into the CreateUserWizard control, to force an update of the panel. Any suggestions on how the structure should be? My code is highly customised, so it's quite long. However, the key structure is similar to this:

<asp:Panel>
  <asp:CreateUserWizard>
    <WizardSteps>
       <asp:CreateUserWizardStep>
          <ContentTemplate>

          //Form Controls here
          </ContentTemplate>
          <CustomNavigationTemplate>
               //The SUBMIT button that should force update
               //CANCEL button
             <asp:ModalPopupExtender /> //References the CANCEL button therefore has to be here
          </CustomNavigationTemplate>

       </asp:CreateUserWizardStep>
    </WizardSteps>
</asp:CreateUserWizard>

</asp:Panel>

Whereabouts would the UpdatePanel be placed? Or is there a more efficient way of ensuring the ModalPopup doesn't close?

Thanks for any help

A: 

Use client side validation or wrap your panel with an update panel and call the Show() method of the modal extender to show the modal from the code-behind.

Paulus E Kurniawan
I tried putting the UpdatePanel around the whole Panel, but I just get the `An extender can't be in a different UpdatePanel than the control it extends.` error.
keyboardP
You shouldn't put your extender in a different UpdatePanel. If you're using a nested UpdatePanel, you need to move the extender out from the inner UpdatePanel, or remove the inner UpdatePanel.
Paulus E Kurniawan
A: 

I managed to solve the problem without using the updatepanel. Instead, I handled the CreateUserWizard's 'Submit' button's onClick event. Here, I got the instance of the ModalPopupExtender existing within the CreateUserWizard control and called its Show() method. I left the ModalPopup declaration within the <CustomNavigationTemplate> tags so that the Cancel button can still be accessed by it.

keyboardP
A: 

I have faced the similar issue and took me whole day to figure it out what's wrong.

This post may help you.

http://patelshailesh.com/index.php/why-does-modalpopup-close-on-postback

shailesh