表结构
姓名 时间 主题 价格 照片URL 会议分类 张三 2000-01-01 00:00:00.000 张三的会议 1.00 a.jpg aaa
李四 2001-01-01 00:00:00.000 李四的会议 2.00 b.jpg aaa
王五 2002-01-01 00:00:00.000 王五的会议 3.00 c.jpg aaa
赵六 2003-01-01 00:00:00.000 赵六的会议 4.00 d.jpg aaa using (DataTable dt = test.GetTable())
{
for (int i = 0; i < dt.Rows.Count; i++)
{ for (int j = 0; j < dt.Columns.Count; j++)
{ row = new TableRow();
if (j == 0)
{
cell = new TableCell();
cell.Attributes.Add("rowspan", dt.Columns.Count.ToString());
Image img = new Image();
img.ImageUrl = "~/meeting/专家.bmp";
cell.Controls.Add(img);
row.Cells.Add(cell);
}
cell = new TableCell();
cell.Width = (Unit)200;
cell.Text = dt.Rows[i][j].ToString();
row.Cells.Add(cell);
Table1.Rows.Add(row); }
}
}
姓名 时间 主题 价格 照片URL 会议分类 张三 2000-01-01 00:00:00.000 张三的会议 1.00 a.jpg aaa
李四 2001-01-01 00:00:00.000 李四的会议 2.00 b.jpg aaa
王五 2002-01-01 00:00:00.000 王五的会议 3.00 c.jpg aaa
赵六 2003-01-01 00:00:00.000 赵六的会议 4.00 d.jpg aaa using (DataTable dt = test.GetTable())
{
for (int i = 0; i < dt.Rows.Count; i++)
{ for (int j = 0; j < dt.Columns.Count; j++)
{ row = new TableRow();
if (j == 0)
{
cell = new TableCell();
cell.Attributes.Add("rowspan", dt.Columns.Count.ToString());
Image img = new Image();
img.ImageUrl = "~/meeting/专家.bmp";
cell.Controls.Add(img);
row.Cells.Add(cell);
}
cell = new TableCell();
cell.Width = (Unit)200;
cell.Text = dt.Rows[i][j].ToString();
row.Cells.Add(cell);
Table1.Rows.Add(row); }
}
}
解决方案 »
- .net fck 图片名随机
- 求解,这段正则表达式错误在哪里?
- 给word文档末尾加了张图片,现在要在此基础上在加东西。会把那张图覆盖了。怎么办。
- TextBox怎么能获得HTML表单中的Text元素的值
- 求助大侠!
- 如何禁用RadioButtonList的某一项?
- dropdownlist中如何显示空格?
- 求一个只有省市的数据库,大家如果有的话请发到我的邮箱,谢谢。
- 有关OA的
- 如果是一个控制台程序,怎么调用javascript?
- override protected void OnInit(EventArgs e)
- 用Visual Web Developer Expresss开发website,生成的dll文件放在那里?
用datalist加个分页就可以了
问题是我现在只能用table去做这个东西。。
{
for (int i = 0; i < dt.Rows.Count; i++)
{
if(i%2==0){
row = new TableRow(); for (int j = 0; j < dt.Columns.Count; j++)
{
if (j == 0)
{
cell = new TableCell();
cell.Attributes.Add("rowspan", dt.Columns.Count.ToString());
Image img = new Image();
img.ImageUrl = "~/meeting/专家.bmp";
cell.Controls.Add(img);
row.Cells.Add(cell);
}
cell = new TableCell();
cell.Width = (Unit)200;
cell.Text = dt.Rows[i][j].ToString();
row.Cells.Add(cell);
}
}else
{ for (int j = 0; j < dt.Columns.Count; j++)
{
if (j == 0)
{
cell = new TableCell();
cell.Attributes.Add("rowspan", dt.Columns.Count.ToString());
Image img = new Image();
img.ImageUrl = "~/meeting/专家.bmp";
cell.Controls.Add(img);
row.Cells.Add(cell);
}
cell = new TableCell();
cell.Width = (Unit)200;
cell.Text = dt.Rows[i][j].ToString();
row.Cells.Add(cell);
}
Table1.Rows.Add(row);
}
}
}