G
Guest
As we know , the view state is not responsible for having TextBoxes,
CheckBoxes, DropDownLists, and other Web controls remember their values
across postback.
When I dynamically add a DropDownList in the web,and dynamically add the
items in it.
such as:
void Page_Load(Object sender, EventArgs e)
{
DropDownList ddlDynamic = new DropDownList();
ddlDynamic.ID = "ddlDynamic";
form1.Controls.Add(ddlDynamic);
if (!IsPostBack)
{
for (int i=1; i <=3; i++)
ddlDynamic.Items.Add(new ListItem(i.ToString(), i.ToString()));
}
I check the second value of the DropDownList.
when post back ,I can see the dynamically items,and the checked value is
what I have checked.
I know that the viewstate of the DropDownList can be loaded by the method
form1.Controls.Add(ddlDynamic) during post back,but I don't know how does the
check value be loaded during post back.
please help me.
CheckBoxes, DropDownLists, and other Web controls remember their values
across postback.
When I dynamically add a DropDownList in the web,and dynamically add the
items in it.
such as:
void Page_Load(Object sender, EventArgs e)
{
DropDownList ddlDynamic = new DropDownList();
ddlDynamic.ID = "ddlDynamic";
form1.Controls.Add(ddlDynamic);
if (!IsPostBack)
{
for (int i=1; i <=3; i++)
ddlDynamic.Items.Add(new ListItem(i.ToString(), i.ToString()));
}
I check the second value of the DropDownList.
when post back ,I can see the dynamically items,and the checked value is
what I have checked.
I know that the viewstate of the DropDownList can be loaded by the method
form1.Controls.Add(ddlDynamic) during post back,but I don't know how does the
check value be loaded during post back.
please help me.