G
Guest
I add controls dynami
Placeholder1.Controls.Clear();
DropDownList d = new DropDownList()
d.ID="controlID"
Placeholder1.Controls.Add(d)
d.Width=200
BindControl(d)
ViewState["AddControl"] = true
and I reload it in Page_load even
private void Page_Load(object sender, System.EventArgs e
if (ViewState["AddControl"]!= null && (bool)ViewState["AddControl"]
DropDownList d = new DropDownList()
d.ID="controlID"
Placeholder1.Controls.Add(d)
it works well, but if I set control's property and Bind Control before it be added to Placeholder1, for exampl
d.Width=200
BindControl(d)
Placeholder1.Controls.Add(d)
it will lost width and listitem after postbac
can anyone tell me why
Placeholder1.Controls.Clear();
DropDownList d = new DropDownList()
d.ID="controlID"
Placeholder1.Controls.Add(d)
d.Width=200
BindControl(d)
ViewState["AddControl"] = true
and I reload it in Page_load even
private void Page_Load(object sender, System.EventArgs e
if (ViewState["AddControl"]!= null && (bool)ViewState["AddControl"]
DropDownList d = new DropDownList()
d.ID="controlID"
Placeholder1.Controls.Add(d)
it works well, but if I set control's property and Bind Control before it be added to Placeholder1, for exampl
d.Width=200
BindControl(d)
Placeholder1.Controls.Add(d)
it will lost width and listitem after postbac
can anyone tell me why