Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

Modal popup disappears

I have a panel with a ddl on it. DropDownlist makes a postback when i choose options from the ddl. It has onSelectedIndexChange and AutoPostback="true".

Now, I use AjaxPopupExtender. I click on a link. I popup the panel. I choose a value from ddl. It makes a post back. ***Disappears****. I have to click on the link again to pop it up and see the ddl again.

I wrapped my panel in Updatepanel but didnt work. What can I do?
<asp:Panel ID="pnlPaymentOptions" CssClass="modalPanel" runat="server" >
   ....
       <asp:DropDownList ID="ddlPaymentType" runat="server" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlPaymentType_SelectedIndexChanged">
                                <asp:ListItem Text="-- Select Payment Type" Value="None"></asp:ListItem>
                                <asp:ListItem Text="Check" Value="Check"></asp:ListItem>
                                <asp:ListItem Text="Money Order" Value="Money Order"></asp:ListItem>
                            </asp:DropDownList>
 
--- This is how I pop it:
<asp:LinkButton ID="lbAddPayment"  runat="server" Text="Add Payment"/>
                </legend>
                 
             <ajaxToolkit:ModalPopupExtender  BackgroundCssClass="modalBackground"  TargetControlID="lbAddPayment" PopupControlID="pnlPaymentOptions"
                                                 ID="ModalPopupExtender2"  runat="server">
                    
              </ajaxToolkit:ModalPopupExtender>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of aibusinesssolutions
aibusinesssolutions
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

I just did this. This keeps the modal-popup on the screen. I can change the ddl value BUT..when I change the ddl value, some sub panels need to show up (visible = true). I step thru the code and it does make a post back...modal popup stays on screen, goes thru correct code but the panels wont show up.

Let me try your method.

This is what I tried:

 <rad:AjaxSetting AjaxControlID="pnlPaymentOptions">
      <UpdatedControls >
       
        <rad:AjaxUpdatedControl  ControlID="ddlPaymentType" />
   
      </UpdatedControls>
     </rad:AjaxSetting>
I tried it. Same thing happens in that the panels that must get visible ..dont show up. I set debug. ddl changes value. It DOES make a postback. Modal popup stays on screen which is good . Code goes thru the right section and set the other panels to visible but the screen doesnt show them.

Do I need to wrap other panels in update panel as well??

this is what i have. See the second panel having "visible="false". Code-behind sets it to true. Code goes thru right section but the panel wont show up:

 <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                         <ContentTemplate>
 
                            <asp:DropDownList ID="ddlPaymentType" runat="server" AutoPostBack="true" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlPaymentType_SelectedIndexChanged">
                                <asp:ListItem Text="-- Select Payment Type" Value="None"></asp:ListItem>
                                <asp:ListItem Text="Check" Value="Check"></asp:ListItem>
                                <asp:ListItem Text="Money Order" Value="Money Order"></asp:ListItem>
                            </asp:DropDownList>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Panel ID="pnlPaymentCreditCard" Visible="false" runat="server">

Open in new window

Yes, if you are setting visible=true in the code behind, then you need to wrap the panel in an update panel as well.


<asp:UpdatePanel runat="server">
    <ContentTemplate>
        <asp:Panel ID="Panel1" runat="server">
            <asp:UpdatePanel runat="server">
                <ContentTemplate>
                    <!-- your drop down list code -->
                </ContentTemplate>
            </asp:UpdatePanel>
        </asp:Panel>
    </ContentTemplate>
</asp:UpdatePanel>

Open in new window

yes, if I wrap the entire section in update panel, then it works. other panels show up fine.
thanks for your help. was going crazy!