我正在使用下面的代码来创建一个多重下拉列表。但我无法保持之前选择的值。请帮助我保持以前的价值。
我的代码在这里:
for (int i = 1; i <= Count; i++)
{
Session["i"] = Count;
Panel1.Controls.Add(new LiteralControl("<br />"));
Label lbl = new Label();
lbl.ID = "lbl" + i;
lbl.Text = "Head";
Panel1.Controls.Add(lbl);
Panel1.Controls.Add(new LiteralControl(" "));
DropDownList ddl = new DropDownList();
ddl.ID = "ID" + i;
ddl.DataValueField = "fld_Head";
ddl.DataTextField = "fld_Head";
ddl.DataSource = DVS;
ddl.DataBind();
Panel1.Controls.Add(ddl);
}