This is a migrated thread and some comments may be shown as answers.

Search Bar Text Changing/Changed Event

3 Answers 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
Mark asked on 31 Mar 2021, 08:26 PM

is there a way to capture when the Search Bar Text is chaging/changed?

 

TIA

 

 

3 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 01 Apr 2021, 04:54 AM

Hello, Mark, 

The MasterView.TableSearchRow offers the SearchProgressChanged event which is fired while the search operation is ongoing and it allows you to get the results in portions as they are discovered: https://docs.telerik.com/devtools/winforms/controls/gridview/rows/search-row 

However, if you want to detect the textbox text changes, please have a look at the following code snippet:
        public RadForm1()
        {
            InitializeComponent();

            this.radGridView1.AllowSearchRow = true;
            this.radGridView1.ViewCellFormatting += radGridView1_ViewCellFormatting; 
        }

        private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
        { 
            GridSearchCellElement searchCell = e.CellElement as GridSearchCellElement;
            if (searchCell != null)
            {
                searchCell.SearchTextBox.TextChanged -= SearchTextBox_TextChanged;
                searchCell.SearchTextBox.TextChanged += SearchTextBox_TextChanged;
            }
        }

        private void SearchTextBox_TextChanged(object sender, EventArgs e)
        {
            GridSearchCellTextBoxElement tb = sender as GridSearchCellTextBoxElement;
            Console.WriteLine(tb.Text);
        }

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

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

0
Mark
Top achievements
Rank 2
Bronze
Bronze
Veteran
answered on 01 Apr 2021, 11:15 AM

Thank you very much.  But I found a better fix for our needs, we just turned set the "AutomaticallySelectFirstResult" to false, which solved our problem.   

 

Thank You

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 01 Apr 2021, 11:18 AM

Hi, Mark,

I am glad that you have found a suitable solution for your case.

Indeed, the AutomaticallySelectFirstResult property determines if the first result found by the search mechanism will be selected and brought into view. If you don't want this behavior, feel free to set the property to false.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

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