Avatar of Camillia
Camillia
Flag 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

ASP.NET

Avatar of undefined
Last Comment
Camillia

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
aibusinesssolutions

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
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>
Camillia

ASKER
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

aibusinesssolutions

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

Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Camillia

ASKER
yes, if I wrap the entire section in update panel, then it works. other panels show up fine.
Camillia

ASKER
thanks for your help. was going crazy!