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>
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.