display text

liunx

Guest
Hi

I'm gathering text from a DB to place on a page. Now I would like to place this text in some sort of Tabel. (eg <!-- m --><a class="postlink" href="http://www.sony.com">http://www.sony.com</a><!-- m --> see table on the bottom). If I use labels (because they can convert the HTML tags) they will expand in size. And i want them to stay at width 190px. So the label needs to stay at 190px and the text has to gon on at the next line. What control should i use? Because I think labels aren't going to work.

thank youCould you give us a bit more detail? I'm not sure I fully understand what you're trying to achieve.

Like many other controls, you can use CSS to control the behaviour at the front end.

AJNFrom Sony's website, they are using a table as the container for the 4 columns. So you could use code similar to this (substitute innerhtml text with the text from you DB):

<html>
<head>
<script runat="server">
Private Sub Page_Load(byval sender as object, byval e as eventargs)
td1.InnerHtml = "Text for column 1"
td2.InnerHtml = "Text for column 2"
td3.InnerHtml = "Text for column 3"
td4.InnerHtml = "Text for column 4"
td1.Style.Add("width", "190px")
td2.Style.Add("width", "190px")
td3.Style.Add("width", "190px")
td4.Style.Add("width", "190px")
End Sub
</script>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td id="td1" runat="server"></td>
<td id="td2" runat="server"></td>
<td id="td3" runat="server"></td>
<td id="td4" runat="server"></td>
</tr>
</table>
</body>
</html>


If the width of the columns is not expected to change, then you should go ahead add a static width to the table cells or far better attach a CSS class to them. You could also substitute a table with <div> tags.
 
Back
Top