Private void Page_Load (object sender, System. EventArgs e)
{
If (! Page. IsPostBack) // Page loading mainly assigns values to the following list.
{
For (int I = 1; I <13; I ++)
{
This. DropDownList1.Items. Add (new ListItem (I. ToString ()));
}
For (int I = 1900; I <2050; I ++)
{
This. DropDownList2.Items. Add (new ListItem (I. ToString ()));
}
}
// Place user code here to initialize the page
}
Form Generation Code
Private void button#click (object sender, System. EventArgs e)
{
// Add controls in the panel using the add set of controls
Int txtw.convert.toint32(this.txt num. Text );
Int btn = Convert. ToInt32 (this. btnnum. Text );
For (int I = 0; I <txt; I ++)
{
This. Panel1.Controls. Add (new TextBox ());
}
For (int I = 0; I <btn; I ++)
{
This. panel1.Controls. add (new Button (); // I have not found a method for adding words to the Button. I have tried several methods. Please let me know if you are interested. Thank you!
}
}
Private void dropdownlistpolicselectedindexchanged (object sender, System. EventArgs e)
{
Int y = Convert. ToInt32 (this. DropDownList2.SelectedItem. Text); // assign a value to the year
Int m = Convert. ToInt32 (this. DropDownList1.SelectedItem. Text); // assign a value to the month
This. Calendar1.VisibleDate = Convert. ToDateTime (m + "/01/" + y); // tell the control to display this day
}
Private void DropDownList2_SelectedIndexChanged (object sender, System. EventArgs e)
{
Int y = Convert. ToInt32 (this. DropDownList2.SelectedItem. Text );
Int m = Convert. ToInt32 (this. DropDownList1.SelectedItem. Text); // same as above
This. Calendar1.VisibleDate = Convert. ToDateTime (m + "/01/" + y );
}
----------------------------------------------------------------
There is a panel, two dropdownlists, two textbox, and one button on the page.