开发者

Make a (collapsible, autosized and always-visible) panel display scrollbar if bigger than the page?

开发者 https://www.devze.com 2023-03-08 12:17 出处:网络
I\'m working with an asp.net master-page; the relevant code is as follows: <body> <form id=\"form1\" runat=\"server\">

I'm working with an asp.net master-page; the relevant code is as follows:

<body>      
  <form id="form1" runat="server">
    <asp:Panel ID="pnlHeader_TopLeft" runat="server"
     onmouseleave="$find('MenuCollapser').collapsePanel();">
      <asp:Panel ID="pnlAppTitle"  runat="server"
       onmouseenter="$find('MenuCollapser').expandPanel();">
         [my title bar]
      </asp:Panel>
      <asp:Panel ID="pnlMenuMain" Style="float: left; clear: both; 
       runat="server">
         [my menu items]
      </asp:Panel>
    </asp:Panel>
    <ajax:CollapsiblePanelExtender BehaviorID="MenuCollapser"
     TargetControlID="pnlMenuMain" ExpandDirection="Vertical"
     SuppressPostBack="true" Collapsed="true" runat="server" />
    <ajax:AlwaysVisibleControlExtender TargetControlID="pnlHeader_TopLeft"
     HorizontalSide="left" VerticalSide="Top" runat="server" />
  </form>
</body>

This works perfectly....unless the contents of pnlMenuMain are so numerous that the panel's height expands beyond the page, obscurring its bottom portion. Is there some way that I can cap its maximum height so that 开发者_Python百科it stops expanding before reaching the screen's max height, and uses a scrollbar instead?


I'd respond in a comment, but my rep is too low at the time being. You should be able to set the height property of the panel and then change the properties of your panel to include

    ScrollBars="Vertical"

The static height property will keep it from automatically expanding the page and the scrollbars attribute should allow you to see all options when the menu options are great in number and go off the page.

0

精彩评论

暂无评论...
验证码 换一张
取 消