private void Clear(Control Parent) { foreach (Control Child in Parent.Controls) { if (Child.HasControls()) Clear(Child); else { if (Child.GetType() == typeof(TextBox)) ((TextBox)Child).Text = ""; } } } protected void Button1_Click(object sender, EventArgs e) { Clear(this.Page); } }
Wednesday, July 27, 2011
Clear all controls in a webform
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment