protected void Button2_Click(object sender, EventArgs e) { ClearInputs(Page.Controls); } void ClearInputs(ControlCollection ctrls) { foreach (Control ctrl in ctrls) { if (ctrl is TextBox) ((TextBox)ctrl).Text = string.Empty; ClearInputs(ctrl.Controls); } }