scrollbar for modalpopup extender

12,458

Solution 1

you could enclose your panel contents in a div with a max-height and overflow: auto

<asp:Panel ID="PnlUpdate" runat="server" Width="500px" CssClass="popup" Height="500px" >
    <div id="Div1" runat="server" style="max-height: 500px; overflow: auto;">

        PANEL CONTENTS 

    </div>
</asp:Panel>

Solution 2

You should give the CSS property to your 'popup' css class. Use the class like given below

.popup {overflow : auto ; height: 500px; }

Share:
12,458
C Sharper
Author by

C Sharper

Updated on June 04, 2022

Comments

  • C Sharper
    C Sharper almost 2 years

    I have following modal popup extender:

    <asp:Label ID="lbl" runat="server"></asp:Label>
    
    
                                            <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="lbl"
                                                PopupControlID="PnlUpdate" BackgroundCssClass="modalBackground"  >
                                            </asp:ModalPopupExtender>
    
                                            <asp:Panel ID="PnlUpdate" runat="server" Width="500px" CssClass="popup" Height="500px" >
                                                <asp:UpdatePanel ID="UpnlModal" runat="server" UpdateMode="Conditional">
                                                    <ContentTemplate>
                                                        <table width="100%">
                                                            <tr>
                                                                <td align="right">
                                                                    <table width="100%" align="center">
                                                                        <tr>
                                                                            <td class="Heading" align="center">
                                                                                <asp:Label ID="lblHeading" runat="server"></asp:Label>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                    <table align="center" width="70%">
                                                                        <tr>
                                                                            <td align="right" class="NormalText">
                                                                                <asp:DataList ID="dlMovies" runat="server" RepeatDirection="Horizontal" RepeatColumns="1"
                                                                                    Width="100%">
                                                                                    <ItemTemplate>
                                                                                        <table align="center" width="70%">
                                                                                            <tr>
                                                                                                <td align="left">
                                                                                                    <asp:Label ID="lblMovieName" runat="server"></asp:Label>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </ItemTemplate>
                                                                                </asp:DataList>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>
                                                            </tr>
                                                        </table>
                                                    </ContentTemplate>
                                                </asp:UpdatePanel>
                                            </asp:Panel>
    

    I want to have scollbar for it.

    I refered How can I make the modal popup scroll its contents with the page? and made css like:

    .modalBackground 
    {
        overflow : auto ;
        background-color:Black ;
        filter:alpha(opacity=65);
        -moz-opacity:0.65;                     
        Opacity:0.65; 
    }
    

    but still scrollbar is not comming, (I have also mentioned Height="500px" for panel.

    Please help me.