0

I'm working with Asp.net. My problem is adding long text inside ContentPlaceHolder. I want to create scrollbar. Which way should I use?

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
</asp:Content>
AyseUnal
  • 3
  • 2
  • 1
    What is happening that shouldn't? Is it wrapping when you dont' want it to? – Ann L. Jan 10 '14 at 15:54
  • You need to tell us more about what you want to achieve. Is it a vertical or horizontal scrollbar that you want? Is the problem getting the scrollbar to appear, or is it the more basic problem of how to make something appear in a `ContentPlaceHolder`? – Ann L. Jan 10 '14 at 16:20
  • My long text spill over content area.I created table in ContentPlaceHolder and I arrange table style as "overflow-y:auto;" but I didn't get resault. I want to add text and then scrollbar should appear only when needed. – AyseUnal Jan 10 '14 at 16:20

1 Answers1

0

First, it sounds like you have the usage of the Content and ContentPlaceHolder tags mixed up. The ContentPlaceHolder goes where you want the content to appear, but is itself left empty. You put the content that you want to have appear in place of the ContentPlaceHolder inside the Content tag. So your table should be inside the Content tag, not inside the ContentPlaceHolder tag.

Second, you might get better results (the appearance of a vertical scrollbar on a table) if you surrounded the table by a DIV tag and put overflow-y:auto; on the DIV rather than the table. It would look like this (assuming inline styles):

 <div style="width:100px;height:100px;overflow-y:auto;">
    <table>
        <tr>
            <td>Information</td>
        </tr>
    </table>
 </div>

Finally, since you didn't mention it, I'll point it out: in order for the overflow handling to work, you need to specify a fixed height for the DIV (as I do above). If it doesn't know it's supposed to be a certain height, it can't determine when it has overflowed.

I hope this helps.

Ann L.
  • 13,760
  • 5
  • 35
  • 66