Reputation: 590
I'm working a comment section page where it allows the user to leave a comment. I need assistance in my layout for displaying the comments into the repeater control. I used to put the comments inside the div element of the item and alternatingitem template of the repeater. And as a result, the comment would go straight along the line in the div element if the user is typing too many words or paragraph. What I want is to put a limit where the text will stop and proceed to the next line of the div element. How would I do that?What is the best way?Any suggestion? Here's my layout for the repeater control where I used to insert the comments.
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td >
<div style="background-color:#FFFF66" >
<%# Eval("Name") %> Says...
<%# Eval("Comments") %>
</div>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr>
<td >
<div style="background-color:#CCFF33" >
<%# Eval("Name")%> Says...
<%# Eval("Comments")%>
</div>
</td>
</tr>
</AlternatingItemTemplate>
<SeparatorTemplate >
<br />
</SeparatorTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
Upvotes: 0
Views: 13971
Reputation: 81
Refer to Is there a way to word-wrap long words in a div?
I had the same problem with a repeater inside a div and I found the answer there.
/* Source: http://snipplr.com/view/10979/css-cross-browser-word-wrap */
.wordwrap {
white-space: pre-wrap; /* CSS3 */
white-space: -moz-pre-wrap; /* Firefox */
white-space: -pre-wrap; /* Opera <7 */
white-space: -o-pre-wrap; /* Opera 7 */
word-wrap: break-word; /* IE */
}
Upvotes: 1
Reputation: 1028
you could do like this to set div border
<div style="border:black 2px">
<!-- content goes here -->
</div>
Upvotes: 1