Gridview Sorting and Filtering Disabled - Threading

2 posts, 0 answers
  1. Arun
    Arun avatar
    7 posts
    Member since:
    Feb 2016

    Posted 10 Oct Link to this post

    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

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3408 posts

    Posted 11 Oct Link to this post

    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.
Back to Top