62,204
社区成员
发帖
与我相关
我的任务
分享
/// <summary>
/// 添加条目
/// </summary>
private void AddOneRowForTable()
{
//生成一行三列
TableRow tr = new TableRow();
TableCell tc = new TableCell();
TableCell tc2 = new TableCell();
TableCell tc3 = new TableCell();
tc.HorizontalAlign = HorizontalAlign.Right;
tc2.HorizontalAlign = HorizontalAlign.Center;
TextBox txtTemp = new TextBox();
txtTemp.Width = 300;
txtTemp.MaxLength = 30;
Label lblTemp = new Label();
lblTemp.Text = "*";
lblTemp.ForeColor = System.Drawing.Color.Red;
tc2.Controls.AddAt(0, txtTemp);
tc2.Controls.AddAt(1, lblTemp);
tc3.HorizontalAlign = HorizontalAlign.Center;
LinkButton lbnTemp = new LinkButton();
LinkButton lbnTemp2 = new LinkButton();
LinkButton lbnTemp3 = new LinkButton();
lbnTemp.Text = "删除";
lbnTemp.Click += lbnDelete_Click;
lbnTemp2.Text = "上移";
lbnTemp2.Click += lbnUp_Click;
lbnTemp3.Text = "下移";
lbnTemp3.Click += lbnDown_Click;
tc3.Controls.AddAt(0, lbnTemp);
tc3.Controls.AddAt(1, lbnTemp2);
tc3.Controls.AddAt(2, lbnTemp3);
tr.Cells.Add(tc);
tr.Cells.Add(tc2);
tr.Cells.Add(tc3);
tblItemAdd.Rows.Add(tr);
}