protected void ClearControl(Control Ctrl)//passing the control
{
foreach (Control eachCtrl in Ctrl.Controls)//loop taking each controls
{
if (eachCtrl.Controls.Count > 0)
ClearControl(eachCtrl);
else if (eachCtrl is TextBox)
((TextBox)eachCtrl).Text = null;
}
}
To call the method like this:
ClearControl(this);
1 comments :
Post a Comment