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

cdemott33Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.