private void ClearAllText(System.Web.UI.Control contrl) { int ctl_count=contrl.Controls.Count; for (int i=0;ictl_count;i ) { foreach(Control ctl in contrl.Controls[i].Controls) { if (ctl.HasControls()) { ClearAllText(ctl.Parent); } else { if (ctl is TextBox) (ctl as TextBox).Text=""; } } } }