Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

Hiding a Panel within a ModalPopupExtendar on Close

I'm going to try to explain this as best as I can and hopefully it makes sense.

I have a panel called PanelAddInvitee that my ModalPopupExtender (MPE) opens.  This panel contains a form and a submit button.  Also, within the PanelAddInvitee panel is another panel called PanelAddResults that has it visibility set to False.  

On postback the form values within the MPE are Inserted into the DB, then the MPE is set to Show() and the Visibility of the PanelAddResults  is set to 'visibile', which displays a message to the user indicating that the Insert was either successful or failed.

Here's my problem.  

When I close the window I need to somehow set the visibility of the PanelAddResults to 'False', so when the user clicks on the button to open the MPE again, the status message isn't visible.

I can't figure out how to do this.  Can someone help me.  My code is below.
<asp:Panel ID="PanelAddInvitee" runat="server" CssClass="modalPopup" style="display:none">
            <div class="modalHeader">
                <div class="modalHeader-Title">Add Invitee</div>
                <div class="modalHeader-CloseButton">
                    <asp:ImageButton ID="btnCancelAddInvitee" runat="server" ImageUrl="~/Images/Close-Window-icon.png" />
                </div>
                <div class="clear"></div>
            </div>
            <div class="modalPopup-generalContentPad">
                <div class="modalPopup-subheader">
                    Add Invitees to this meeting.
                </div>
                <div class="modalPopup-helptext">
                    Please fill out the form below to add invitees to your meeting.  Fields marked with an asterick are required.
                </div>
                <div>
                    <asp:ValidationSummary ID="ValidationSummary3" runat="server" HeaderText="Please correct the following errors:" ValidationGroup="vsum_AddInvitees" CssClass="validation_summary" />
                </div>
                    <table class="modalTable">
                        <tr>
                            <td valign="top" class="modalTableFieldNames">
                                * First Name:</td>
                            <td>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="First name is required." ControlToValidate="tbn_FirstName" Text="*" Display="Dynamic" ValidationGroup="vsum_AddInvitees"></asp:RequiredFieldValidator>
                                <asp:TextBox ID="tbn_FirstName" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                            <td valign="top" class="modalTableFieldNames">
                                * Last Name:</td>
                            <td>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="Last name is required." ControlToValidate="tbn_LastName" Text="*" Display="Dynamic" ValidationGroup="vsum_AddInvitees"></asp:RequiredFieldValidator>
                                <asp:TextBox ID="tbn_LastName" runat="server"></asp:TextBox></td>
                        </tr>  
                        <tr>
                            <td valign="top">
                                &nbsp;</td>
                            <td>
                                <asp:Button ID="btnAddNewInvitee" runat="server" UseSubmitBehavior="false" CssClass="modalPopup-ButtonAddEdit" Text="Add Invitee" ValidationGroup="vsum_AddInvitees" />
                                &nbsp;<asp:Button ID="btnCancelNewInvitee" runat="server" OnClientClick="$find('modalAddInvitee').hide(); return false;" CssClass="modalPopup-ButtonCancel" UseSubmitBehavior="False" Text="Cancel" />
                            </td>
                        </tr>                      
                    </table>
                <asp:Panel ID="PanelAddResults" runat="server" Visible="true" CssClass="modalPopup-ResultsMessage">
                    <asp:Image ID="imgProposalResults" runat="server" />
                    &nbsp;<asp:Label ID="lbAddInviteeResults" runat="server" Text="" CssClass="modalPopup-ResultsText"></asp:Label>
                </asp:Panel>
    
            </div>
        </asp:Panel>

Open in new window

0
cdemott33
Asked:
cdemott33
  • 2
  • 2
1 Solution
 
CodeCruiserCommented:
Do you use a control to close the popup? You can do something like below

http://stackoverflow.com/questions/142633/modalpopupextender-ok-button-click-event-not-firing
0
 
cdemott33Author Commented:
I just use a button to close the pop-up.  

<asp:ImageButton ID="btnCancelAddInvitee" runat="server" ImageUrl="~/Images/Close-Window-icon.png" />

(See ModalPopupExtender code as well... if this helps)

I've read through the link you sent but I don't see an answer to my question.  Maybe I'm missing it.  Can you help?


<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" 
        TargetControlID="btnLaunchAddInviteeModal" 
        PopupControlID="PanelAddInvitee" 
        OkControlID="btnCancelAddInvitee" 
        BackgroundCssClass="modalBackground" 
        DropShadow="true" 
        BehaviorID="modalAddInvitee" OnOkScript="clearLabel()">
    </asp:ModalPopupExtender>

Open in new window

0
 
cdemott33Author Commented:
Okay, I believe I figure this one out.  I added the following Javascript:

    <script type="text/javascript">
        function clearLabel() {
            document.getElementById('<%=PanelAddResults.ClientID %>').style.display = "none";
            document.getElementById('<%= lbAddInviteeResults.ClientID %>').value = "I changed the Text";
        }    
    </script>

and in my MPE I added this to my OnOkScript attribute.

    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server"
        TargetControlID="btnLaunchAddInviteeModal"
        PopupControlID="PanelAddInvitee"
        OkControlID="btnCancelAddInvitee"
        OnOkScript="clearLabel();"        BackgroundCssClass="modalBackground"
        DropShadow="true"
        BehaviorID="modalAddInvitee">
    </asp:ModalPopupExtender>
0
 
CodeCruiserCommented:
Yeah that would do. The example in link I posted was doing this in code behind.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now