#region 清除
protected void btnClear_Click(object sender, EventArgs e)
{
foreach (Control ctl in this.Controls)
{
this.txtClear(ctl);
}
}
#endregion
private void txtClear(Control ctls)
{
if(ctls.HasControls())
{
foreach (Control ctl in ctls.Controls)
{
txtClear(ctl);
}
}
else
{
if (ctls.GetType().Name == "TextBox")
{
TextBox tb = new TextBox();
tb = (TextBox)this.FindControl(ctls.ID);
tb.Text = "";
}
else if (ctls.GetType().Name == "DropDownList")
{
DropDownList ddl = new DropDownList();
ddl = (DropDownList)this.FindControl(ctls.ID);
ddl.SelectedIndex = 1;
}
}
}






