sp.net 动态增加表格,增加的内容竖着【排列
已经增加的内容显示样子,内容显示是正确的,每一行是一个表格的一行:我希望显示的格式成这样:
已经完成的代码如下:
for (int i = 0; i < bookcount; i++)
{
String strurl = datas.Tables["id"].Rows[i]["url"].ToString();
String strname = datas.Tables["id"].Rows[i]["name"].ToString();
String strinfo = datas.Tables["id"].Rows[i]["info"].ToString();
double price = Convert.ToDouble(datas.Tables["id"].Rows[i]["price"]);
TableRow row = new TableRow(); ;//声明表的一列的实例
TableCell cell = new TableCell(); //声明表的一列中单元格的实例
Image imagei = new Image();
imagei.ImageUrl = strurl.Trim();
imagei.Width = 200;
imagei.Height = 100;
TextBox text1 = new TextBox();
text1.Text = strname;
TextBox text2 = new TextBox();
text2.Text = price.ToString();
TextBox text3 = new TextBox();
text3.Text = strinfo;
Label l1 = new Label();
l1.Text = "书名";
Label l2 = new Label();
l2.Text = "价格";
Label l3 = new Label();
l3.Text = "简介";
cell.Controls.Add(imagei);
cell.Controls.Add(l1);
cell.Controls.Add(text1); //把textbox加入表格
cell.Controls.Add(l2);
cell.Controls.Add(text2);
cell.Controls.Add(l3);
cell.Controls.Add(text3);
row.Cells.Add(cell);//把单元格添加在列中
this.Table1.Rows.Add(row);
}
在线等呀,急!!! asp.net table --------------------编程问答-------------------- 你循环列不就可以了。。。 --------------------编程问答--------------------
先列,后行的循环,
foreach(colums)
{
for(row)
{
这里是图
}
for(row)
{
这里是...
}
...
}
补充:.NET技术 , ASP.NET