- 一段清空页面控件输入的函数
- protected void Button_clear_Click(object sender, EventArgs e)
- {
- //查找panel1中任何的控件
- foreach(Control ct in Panel1.Controls)
- {
- if (ct is TextBox)
- {
- TextBox tb = (TextBox)ct;
- tb.Text = "";
- }
- if(ct is RadioButton)
- {
- RadioButton rb = (RadioButton)ct;
- if (rb.ID == "RadioButton_double")
- rb.Checked = true;
- else
- rb.Checked = false;
- }
- if (ct is DropDownList)
- {
- DropDownList drop = (DropDownList)ct;
- drop.SelectedIndex = 0;
- }
- }
- foreach(Control ct in Panel2.Controls)
- {
- if (ct is GridView)
- ct.Visible = false;
- if (ct is Button)
- ct.Visible = false;
- }
- }
清空页面控件的输入
最新推荐文章于 2021-10-17 19:38:35 发布