In Our applications in most of the cases we have to clear all text boxes (when Cancel or Reset button is clicked)
This code is to clear all text boxes in the form .
Use This code in Button click event
public void imgcancel_Click(object sender, ImageClickEventArgs e) {
FindControl(Form.Controls);
}
'Find Control Method Definition
public static void FindControl(ControlCollection ChildCtrls)
{
foreach (Control Ctrl in ChildCtrls)
{
if (Ctrl is TextBox)
((TextBox)Ctrl).Text = "";
else
FindControl(Ctrl.Controls);
}
}
Friday, November 21, 2008
Clear all Textboxes
Labels:
C#,
Vijaya Kadiyala
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment