能動態添加就是不怎會定位....
for (j = 0; j < ds.Tables[0].Rows.Count; j++)//ds為Dataset的對象,
{
string strname1 = ds.Tables[0].Rows[j][0].ToString();
HtmlGenericControl div = new HtmlGenericControl("div");
div.Style.Add("width", "100px");
div.Style.Add("height", "40px");
Label lab = new Label();
TextBox txt = new TextBox();
txt.ID = "txt_object" + j.ToString();
lab.Text = strname1 + ":";
txt.Width = Unit.Pixel(50);
div.Controls.Add(lab);
div.Controls.Add(txt);
this.Page.Form.Controls.Add(div);
}
得到文本框裡面得值
protected void Button1_Click(object sender, EventArgs e)
{
int i = 1;//假定i為1
&