我在page_Load中加入了一些控件,如下:
TextBox txtBox
=
new
TextBox();
txtBox.ID = " name " ;
txtBox.Text = " haha " ;
CheckBox ckBox = new CheckBox();
ckBox.ID = " ffff " ;
DropDownList ddlList = new DropDownList();
ddlList.ID = " gggg " ;
ddlList.Items.Add( new ListItem( " 111 " , " 111 " ));
ddlList.Items.Add( new ListItem( " 222 " , " 222 " ));
ddlList.Items.Add( new ListItem( " 333 " , " 333 " ));
form1.Controls.Add(txtBox);
form1.Controls.Add(ckBox);
form1.Controls.Add(ddlList);
txtBox.ID = " name " ;
txtBox.Text = " haha " ;
CheckBox ckBox = new CheckBox();
ckBox.ID = " ffff " ;
DropDownList ddlList = new DropDownList();
ddlList.ID = " gggg " ;
ddlList.Items.Add( new ListItem( " 111 " , " 111 " ));
ddlList.Items.Add( new ListItem( " 222 " , " 222 " ));
ddlList.Items.Add( new ListItem( " 333 " , " 333 " ));
form1.Controls.Add(txtBox);
form1.Controls.Add(ckBox);
form1.Controls.Add(ddlList);
当在当前页面点按钮后,之前输入的值会保存在页面上显示
本文转自永春博客园博客,原文链接:http://www.cnblogs.com/firstyi/archive/2006/10/25/539614.html,如需转载请自行联系原作者