how to break a line in column

Posted by Oswaldlily under ASP.NET on 8/24/2011 | Points: 10 | Views : 2238 | Status : [Member] | Replies : 3
I have added database into asp table dynamically.

Dim trow As New TableRow
Dim a As New TableCell
a.Controls.Add(New LiteralControl(Columnname1))
trow.Cells.Add(a)
table.Rows.Add(trow)

My row sentence is very long..Inorder to break that line,what should i do?




Responses

Posted by: Dhirendra on: 8/24/2011 [Member] Starter | Points: 25

Up
0
Down
it should automatically do it for you if you set the width of that column...there is one attribute.style you can assign <td nowrap="nowrap"> but it does opposite..so default is wrap...

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Oswaldlily on: 8/24/2011 [Member] Starter | Points: 25

Up
0
Down
this not workin..tell somother

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dhirendra on: 8/24/2011 [Member] Starter | Points: 25

Up
0
Down
Ok..there is one more solution

add <br> tag in your text where you want line break

here is sample

Table tbl = new Table();
tbl.BorderWidth = new Unit(2);
TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.BorderWidth = new Unit(2);
cell.Text = "this is cell 1 text gdfhjgdhfgdfhgjh gdfhgfdhg ghdfgkjfdhg gdfhgjdfh gdfhgkjdfh gfdhgkdfjh gfdg hdkfjghfdhkgjhdfg gdfhgkj h <br>";
cell.Wrap = true;
row.Cells.Add(cell);
cell = new TableCell();
cell.BorderWidth = new Unit(2);
cell.Text = "gfdhgkdfjh gfdg hdkfjghfdhkgjhdfg gdfhgkj h <br> this is cell 1 text gdfhjgdhfgdfhgjh gdfhgfdhg ghdfgkjfdhg gdfhgjdfh gdfhgkjdfh ";
row.Cells.Add(cell);
tbl.Rows.Add(row);

sample output Image is attached....
 Download source file

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response