asp.net 动态表格记录
一、asp:table
TableRow row;
TableCell cell;
//for (int i = 0; i < 5; i++)
//{
row = new TableRow();
//添加第0列
cell = new TableCell();
DropDownList drop = new DropDownList();
drop.ID = string.Concat("drop_", i);
drop.Items.Add(new ListItem("其他队员", "0"));
drop.Items.Add(new ListItem("队长", "1"));
cell.HorizontalAlign = HorizontalAlign.Center;
cell.Controls.Add(drop);
row.Cells.Add(cell);
//添加第1列 name
cell = new TableCell();
//cell.Style.Add("word-wrap", "break-word");//控制table换行
TextBox txt = new TextBox();
txt.Width = 80;
txt.ID = string.Concat("name_", i);
cell.Controls.Add(txt);
row.Cells.Add(cell);
//添加第2列 sex
cell = new TableCell();
RadioButton rb = new RadioButton();
rb.ID = "1";
rb.Text = "男";
rb.GroupName = string.Concat("sexgroup", i);
RadioButton rb1 = new RadioButton();
rb1.ID = "0";
rb1.Text = "女";
rb1.GroupName = string.Concat("sexgroup", i);
cell.Controls.Add(rb);
cell.Controls.Add(rb1);
row.Cells.Add(cell);
tabletem.Rows.Add(row);
//Response.Write("<hr>");
//for (int i = 0; i < Request.Form.Count; i++)
// Response.Write("<li>" + Request.Form.Keys[i].ToString() + " = " + Request.Form[i].ToString());
//Response.Write("<hr>");

浙公网安备 33010602011771号