**** c# ***
beschermde nietige Page_Load (objecten afzender, EventArgs e)
{
als (! IsPostBack)
CreateCtrls ();
}
privé nietige CreateCtrls ()
{
DropDownList ddl1 = nieuwe DropDownList ();
ddl1.ID = „ddl1“;
ddl1.Items.Add („asdf0“);
ddl1.Items.Add („asdf1“);
ddl1.Items.Add („asdf2“);
ddl1.Items.Add („asdf3“);
pnl. Controls.Add (ddl1);
DropDownList ddl2 = nieuwe DropDownList ();
ddl2.ID = „ddl2“;
ddl2.Items.Add („lkjh0“);
ddl2.Items.Add („lkjh1“);
ddl2.Items.Add („lkjh2“);
ddl2.Items.Add („lkjh3“);
pnl. Controls.Add (ddl2);
ViewState [„ControlsAdded2“] = waar;
}
beschermde nietige btn1_Click (objecten afzender, EventArgs e)
{
}
beschermde opheffing nietige LoadViewState (voorwerp savedState)
{
base.LoadViewState (savedState);
als (ongeldige ViewState [„controlsadded1“] ==)
{
CreateCtrls ();
}
}
**** aspx ***
|