动态表格,怎样设置列宽,每一行都不同。
表格,怎样设置使第一行的列宽是自定义的,而不是自动对齐的?(默认是新增的单元格列宽与上一行同样的)
//以下生成的表格列宽是自动对齐的。
aspx:
<asp:table border="0" cellspacing="0" runat="server" id="user_info_list" >
<asp:TableRow BackColor="#00E200"></asp:TableRow>
</asp:table>
cs:
TableRow []tr;
TableCell []tc;
int row = 0, cell_count = 0;
tr[i] = new TableRow();
tc[cell_count] = new TableCell();
tc[cell_count].Text = "a";
tr[i].Cells.Add(tc[cell_count]);
cell_count++;
tc[cell_count] = new TableCell();
tc[cell_count].Text = "b";
tr[cell_count].Cells.Add(tc[cell_count]);
cell_count++;
tc[cell_count] = new TableCell();
tc[cell_count].Text = "c";
tr[cell_count].Cells.Add(tc[cell_count]);
cell_count++;
table_id.Rows.Add(tr[i]);
i++;
//...
tr[i] = new TableRow();
tc[cell_count] = new TableCell();
tc[cell_count].Text = "a";
tr[i].Cells.Add(tc[cell_count]);
cell_count++;
tc[cell_count] = new TableCell();
tc[cell_count].Text = "b";
tr[cell_count].Cells.Add(tc[cell_count]);
cell_count++;
tc[cell_count] = new TableCell();
tc[cell_count].Text = "b";
tr[cell_count].Cells.Add(tc[cell_count]);
cell_count++;
tc[cell_count] = new TableCell();
tc[cell_count].Text = "d";
tr[cell_count].Cells.Add(tc[cell_count]);
cell_count++;
table_id.Rows.Add(tr[i]);
i++;