Clear Button in RadTextBox or RadTextBoxControl

1 Answer 543 Views
TextBox TextBoxControl
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Mark asked on 29 Mar 2022, 06:15 PM

Is there a way to capture when the "Clear Button" in the RadTextBox/RadTextBoxControl is clicked?

 


Thank you

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 30 Mar 2022, 05:11 AM

Hello, Mark,

I have prepared a sample code snippet demonstrating how to handle the Click event for the ClearButton inside RadTextBox and RadTextBoxControl:

        public RadForm1()
        {
            InitializeComponent();

            this.radTextBox1.Text = this.radTextBoxControl1.Text = "Telerik";
            this.radTextBox1.ShowClearButton = true;
            this.radTextBoxControl1.ShowClearButton = true;

            this.radTextBox1.TextBoxElement.ClearButton.Click += ClearButton_Click;
            this.radTextBoxControl1.TextBoxElement.ClearButton.Click+=TextBoxElement_Click;
        }

        private void TextBoxElement_Click(object sender, EventArgs e)
        {
            Console.WriteLine("RadTextBoxControl is cleared");
        }

        private void ClearButton_Click(object sender, EventArgs e)
        {
            Console.WriteLine("RadTextBox is cleared");
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Principal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
commented on 30 Mar 2022, 10:55 AM

It absolutely does. I was looking all over for it and never thought to look at the TextBoxElement for ClearButton....

 

Thanks again.

Tags
TextBox TextBoxControl
Asked by
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or