62,047
社区成员
发帖
与我相关
我的任务
分享
for (int i = 0; i < temp; ++i)
{
this.NewTableRow(i);
}
protected void NewTableRow(int i)
{
TableRow tr = new TableRow();
TableCell tc;
TextBox tb;
Label td;
DropDownList tl;
int rowqty = i + 1;
tc = new TableCell();
td = new Label();
td.CssClass = "FieldStyle";
td.ID = "txtDel" + i;
td.Text = "" + rowqty;
tc.Controls.Add(td);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.ID = "txtItemno" + i;
tb.Attributes.Add("ondblclick", "getItem('" + i + "');");
tb.Attributes.Add("onclick", "getSelect('txtItemno"+ i + "');");
tc.Controls.Add(tb);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.TextMode = TextBoxMode.MultiLine;
tb.Rows = 2;
tb.ID = "txtDes" + i;
tb.Attributes.Add("onblur", "getfu('txtDes" + i + "');");
tc.Controls.Add(tb);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.ID = "txtModel" + i;
tb.Attributes.Add("onblur", "getfu('txtModel" + i + "');");
tc.Controls.Add(tb);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.ID = "txtQty" + i;
tb.Attributes.Add("onblur", "getsum('txtQty" + i + "');");
tb.Attributes.Add("onclick", "getSelect('txtQty" + i + "');");
tc.Controls.Add(tb);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.ID = "txtUOM" + i;
tc.Controls.Add(tb);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
//tb.ReadOnly = true;
tb.ID = "txtDate" + i;
tb.Attributes.Add("onclick","SelectDate(this,'yyyy-MM-dd')");
tc.Controls.Add(tb);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.ID = "txtUPrice" + i;
tb.Attributes.Add("onblur", "getsum('txtUprice" + i + "');");
tb.Attributes.Add("onclick", "getSelect('txtUprice" + i + "');");
tc.Controls.Add(tb);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.ID = "txtAccount" + i;
tc.Controls.Add(tb);
tr.Cells.Add(tc);
tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.ID = "txtQuote" + i;
tc.Controls.Add(tb);
tr.Cells.Add(tc);
/*tc = new TableCell();
tb = new TextBox();
tb.CssClass = "FieldStyle";
tb.ID = "txtBuyer" + i;
tb.ReadOnly();
tc.Controls.Add(tb);
tr.Cells.Add(tc);*/
tc = new TableCell();
tl = new DropDownList();
tl.CssClass = "FieldStyle";
tl.ID = "txtBuyer" + i;
// tl.Style.Add("height", "21px");
for (int j = 0; j < tBuyer.Length; j++)
{
if (tBuyer[j]=="" | tBuyer[j]==null)
break;
tl.Items.Add(new ListItem(tBuyer[j],tBuyer[j]));
}
tr.Cells.Add(tc);
tc.Controls.Add(tl);
//DropDownList("txtBuyer" + i).DataSource = tBuyer;
//DropDownList("txtBuyer" + i).DataBind();
// Enumerable.Range(1, 10).Select("txtBuyer" + i).ToList().ForEach(tl.Items.Add(i));
this.m_table.Rows.Add(tr);
}
protected void btnAddDetail_Click(object sender, EventArgs e)
{
this.NewTableRow(this.Num++);
Label1.Text = this.Num.ToString();
}