Search code examples
asp.netajaxcontroltoolkit

How do I hide panels when there is no default extender id


I am using the .NET AjaxControlToolkit (don't ask why, I inherited this project). I create panels and then using a button, pup up the panel as follows:

<asp:LinkButton ID="lbReplaceImage" runat="server"><img src="/images/pencil.gif" alt="edit image" /></asp:LinkButton>
<cc1:ModalPopupExtender ID="mpeReplaceImages" runat="server" TargetControlID="lbReplaceImage" BackgroundCssClass="modalBackground" 
                            PopupControlID="pnlReplaceImage" CancelControlID="btnReplaceImageCancel" OkControlID="btnReplaceImageOK">
</cc1:ModalPopupExtender>

And then:

<asp:Panel ID="pnlReplaceImage" runat="server" BackColor="White" CssClass="container">
 .
 .
 .
</asp:Panel>

My issue is that first time in the system, there is no data in the table and so the panel is not hidden by the system. I tried to use CSS to hide the panel, but then it never gets turned back on. Is there some operator that will enable the panel to stay hidden even if there are no modal popup controls on the page?


Solution

  • What CSS did you use to hide the panel? visibility:hidden?

    Have you tried:

    style="display:none"
    

    I've run into this issue before and this worked for me.

    Edited: As discussed below, in order for the line above to work it must be placed as inline CSS:

    <asp:Panel ID="pnlReplaceImage" runat="server" CssClass="container" style="display:none">
     .
     .
     .
    </asp:Panel>