后台生成textbox并设置多行属性,自动换行

Table tb = new Table();
TableRow row1 = new TableRow();
TableCell tc1 = new TableCell();
TableCell tc2 = new TableCell();

Image img = new Image();
img.ImageUrl = item.Picurl;

TextBox text = new TextBox();
text.Text = item.Notes;
text.CssClass = "text";
text.Wrap = true;
text.TextMode = TextBoxMode.MultiLine;

tc1.Controls.Add(img);
tc2.Controls.Add(text);

row1.Controls.Add(tc1);
row1.Controls.Add(tc2);

tb.Controls.Add(row1);

photos.Controls.Add(tb);

原文地址:https://www.cnblogs.com/ctautocn/p/4231837.html