ClearInputs(Page.Controls);
private void ClearInputs(ControlCollection ctrls) { foreach (Control ctrl in ctrls) { if (ctrl is TextBox) ((TextBox)ctrl).Text = string.Empty; else if (ctrl is DropDownList) ((DropDownList)ctrl).ClearSelection(); ClearInputs(ctrl.Controls); } }
Reference: http://stackoverflow.com/questions/4872364/clearing-all-fields-in-an-asp-net-form
Last Updated on October 26, 2015