Clear All TextBox control using a Common Method | Clear the Control Text using a Common Method

I have implemenetd a common method to clear the Text of few Controls. One of that is Textbox.If  sometimes you requires to clear all the input fields of a web page then just call the below c# method this method will clear all textbox values to empty. 


public void ClearAllTextBOX(ControlCollection ctrls)
    {
        foreach (Control ctrl in ctrls)
        {
            if (ctrl is TextBox)
                ((TextBox)ctrl).Text = string.Empty;
            ClearInputs(ctrl.Controls);
        }
    }

Tags: , , ,

Join Us!