Scrollbars for ContentPlace Holder

Last post 04-11-2008 7:18 AM by kumarm_ttu. 4 replies.

Sort Posts:

  • Scrollbars for ContentPlace Holder

    08-23-2007, 12:54 AM
    • Member
      12 point Member
    • sivavenugopal
    • Member since 08-16-2007, 7:41 AM
    • Hyderabad
    • Posts 11

    Hi All,

     My problem is that I cannot work out how to make the masterpage Content Section's 'contentplaceholder' scrollable.  In addition to this if I change the screen resolution or view in different browers everything gets stretched and/or misaligned.

    Basically I want the left ad panels, banner and footer sections to remain static across the whole website and only the content section to change as each new page is loaded into it. However, if the content page has a lot of text/images etc I want that section to be scrollable, and only scrollable where there is an overflow on the content sections height. At the moment the content panel grows and pushes my footer off the bottom of the page.

    I am calling this page using a javascript (window.open()) method with scrollbars=no. Because i don't want any scrollbars to entire page. I need scrollbars only to the ContentPlaceholder.

    I used the DIV tag but it is also not working. Please help me in this regard.

    Siva
    Filed under: ,
  • Re: Scrollbars for ContentPlace Holder

    08-23-2007, 2:48 AM
    • Contributor
      2,847 point Contributor
    • klaus_b
    • Member since 05-03-2006, 1:11 PM
    • Bavaria, Germany
    • Posts 566

    Hi sivavenugopal,

    AFAIK there is no way to add scrollbars to the contentplaceholder. But maybe it helps to put the comtentplaceholder inside a div. The div must reside in the masterpage. Give the div style a fixed width an hight. Add the overflow scrollbar attribute to divs vertical axis. Now it should works as expected.

     

    Servus,
    Klaus

    I haven't the faintest idea, but great many therefrom.
    klaus_b@.NET
  • Re: Scrollbars for ContentPlace Holder

    08-24-2007, 11:37 AM
    Answer
    • Contributor
      2,847 point Contributor
    • klaus_b
    • Member since 05-03-2006, 1:11 PM
    • Bavaria, Germany
    • Posts 566

    Here is an example the works as expected on my machine.

    the master page

     

    <div id="MainContent" runat="server" class="MainContent">
    	<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
    	</asp:ContentPlaceHolder>
    </div>

     and the css class

    .MainContent
    {
    	position: relative;
    	top: 0px;
    	left: 0px;
    	width: 100%;
    	overflow: auto;
    	cursor: default;
    }
    

     Hope that could help you

     

    Servus,
    Klaus

    I haven't the faintest idea, but great many therefrom.
    klaus_b@.NET
  • Re: Scrollbars for ContentPlace Holder

    08-26-2007, 9:00 AM
    Answer
    • Member
      89 point Member
    • machta
    • Member since 08-23-2007, 8:35 AM
    • Czech Republic
    • Posts 38

    If you want to solve this problem you can do it in two different ways:

    Firstly you can use iframe instead of the content place holder, but it's not good solution for asp.net that provides so many web controls - it's solution for begginers who use html.( I have used this way until I started to learn asp.net and started to use master pages.)

    The better way how to make the scrollbar is to put the "ContentPlaceHolder" into web control named "Panel". Then you can choose where you want to have the scrollbar. Don't forget to set width or height of the panel! Use it at the same position in code as "div" tag in the previous post.

    Please write here if you'll choose one of my solutions. I think that the second one is better than klaus's :-) But it's just my opinion ...

  • Re: Scrollbars for ContentPlace Holder

    04-11-2008, 7:18 AM
    • Member
      173 point Member
    • kumarm_ttu
    • Member since 02-01-2006, 7:17 AM
    • Bangaluru(India)
    • Posts 66

    Hi

    Dont change contentplaceholder. put a division in content page. automatically scrollbars will come whenever u r content increases.

    <asp:Content ID ="contentOne" runat ="server" ContentPlaceHolderID ="cphMainContent">

    <div style="padding-top:50px;padding-left:300px;padding-right:300px;font-size:11px; " >

    </div>

    </asp:Content>

    i hope this will help you.

     

    Thanks & Regards
    Sanjay.
Page 1 of 1 (5 items)