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

Gridview Sorting and Filtering Disabled - Threading

1 Answer 95 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Arun
Top achievements
Rank 2
Iron
Arun asked on 10 Oct 2019, 11:40 AM

HI, 

When the data is loading directly on form load, Sorting and Filtering is functioning well. When it's through threading, sorting and filtering options not working.

VB.Net | Sql Server

Telerik Winforms

01.Dim thread_Data As Thread
02.Private Sub RadFrmFupReport_Load(sender As Object, e As EventArgs) Handles Me.Load
03.        RadFrmFupReport.CheckForIllegalCrossThreadCalls = False
04.        Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo("en-US", False)
05.        thread_Data = New Thread(AddressOf LoadData)
06.        thread_Data.Start()
07.End Sub
08. 
09.Private Sub LoadData()
10.        Ta_Dt_Fup.Fill(Me.DS_Genius.dt_FUP)
11.        Vw_FUP_GroupTableAdapter.Fill(Me.DS_Genius.vw_FUP_Group)
12.        radGrdFup.DataSource = DS_Genius.vw_FUP_Group
13.
End Sub

If "LoadData" function called directly in form load event, taking 4-5 seconds to load the form. So used thread.  

Please help. Thanks in advance

Arun

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Oct 2019, 08:44 AM

Hello, Arun,      

Note that all UI controls are not thread safe controls in the whole Windows Forms platform (not just Telerik controls, but all controls out there). Here is an article on MSDN, describing how to make thread-safe Winforms UI application. This means that any control from the Telerik UI for WinForms suite is not thread safe as well and cannot be used outside the main UI thread. You should use an Invoke to update the controls in cross threading scenario.

I would recommend you to use a BackgroundWorker for extracting the data asynchronously. In the RunWorkerCompleted event you can set the RadGridView. DataSource property to the collection filled with the extracted data. The following StackOverflow thread demonstrates a sample approach how to bind a grid using a BackgroundWorker. You may follow a similar approach with RadGridView: https://stackoverflow.com/questions/3127838/fill-datagridview-thanks-to-backgroundworker

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

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
Arun
Top achievements
Rank 2
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or