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

How to determine that RadGridView is searching

1 Answer 158 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Valery
Top achievements
Rank 1
Veteran
Valery asked on 31 Jan 2019, 08:25 AM

In RadGridView, the user can set the string to search.

How to determine that RadGridView is searching? Is it possible to programmatically interrupt the search process?

If there are many rows in the table, the search can take quite a long time. If the user does not wait for the end of the search and closes the form with the RadGridView, an error occurs.

 

************** Текст исключения **************
System.ObjectDisposedException: Доступ к ликвидированному объекту невозможен.
Имя объекта: "RadGridView".
в System.Windows.Forms.Control.MarshaledInvoke(Control caller, Delegate method, Object[] args, Boolean synchronous)
в System.Windows.Forms.Control.Invoke(Delegate method, Object[] args)
в Telerik.WinControls.UI.GridSearchCellElement.searchRow_SearchProgressChanged(Object sender, SearchProgressChangedEventArgs e)
в Telerik.WinControls.UI.GridViewSearchRowInfo.OnSearchProgressChanged(SearchProgressChangedEventArgs e)
в Telerik.WinControls.UI.GridViewSearchRowInfo.ReportSearchProgress(Int32 percent, GridSearchResultCellInfo resultCell, GridSearchResultCellCollection resultCells)
в Telerik.WinControls.UI.GridViewSearchRowInfo.TraverseRows(DoWorkEventArgs e)

 

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Feb 2019, 12:01 PM
Hello, Valery,        

The IsSearching property of the GridViewSearchRowInfo indicates if there is an ongoing search operation at the moment. Its value can be accessed by the MasterView.TableSearchRow.IsSearching property. 

The GridViewSearchRowInfo also offers CloseOnEscape the property. It controls whether to close the search row when escape key is pressed. In addition, you can cancel the current search operation by using the following code snippet:
this.radGridView1.MasterView.TableSearchRow.IsSearchAsync = false;
GridViewSearchRowInfo.Cancel = true;

As to the error, I have prepared a sample project. However, I was unable to replicate the error on my end. I have attached my sample project for your reference. Could you please specify the exact steps how to reproduce the problem? Thank you in advance. 

I am looking forward to your reply. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Valery
Top achievements
Rank 1
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or