0

I'm using vb.net 2017 , Entity Framework 6 with sql server 2008r2.

On my form I have a devexpress gridview. The gridview is bound to a Bindingsource ( MyBindingsource ) on design time.

My table on database has around 2300 records.

On runtime I have this code :

....

dim myquery as ienumerable(of Myobject)
myQuery=From t in Context.Myobject select t
Mybindingsource.Datasource=Myquery.Tolist

all these instructions are executed instantly , and I've checked that the query contains all the 2300 records , but after that It need 4 minutes to display all the records in Gridview.

What can I do ?

Thank you !

Update

I have investigated all the events that i'm using with my grid , and i have detected that all the problems were caused by this :

Private Sub gridView_CustomRowFilter(sender As Object, e As    DevExpress.XtraGrid.Views.Base.RowFilterEventArgs)
    Dim gridr As Object = gridView.GetRow(e.ListSourceRow)

    e.Visible = IsNothing(gridr) OrElse context.Entry(gridr).State <> Entity.EntityState.Deleted
    e.Handled = True
End Sub

With small data there's no problem , and this is why i have not noticed before. But i need this event because when the user delete a record , i don't delete it from bindingsource until the save button is pressed , but i want to hide from gridview.

What can i do ?

Thank you !

Adriano
  • 57
  • 1
  • 9
  • 1
    There are [several support tickets](https://www.google.com/search?q=devexpress+grid+slow+load) about this. You should read some of them. – Robert Harvey Dec 05 '18 at 17:30
  • I've already red them , but none helped. I can read data from database very quickly , the problem is that the gridview is displaying them too slow. – Adriano Dec 05 '18 at 17:44
  • Is this Winforms? Webforms? WPF? ASP.NET MVC? – Robert Harvey Dec 05 '18 at 17:51
  • I'm using winforms – Adriano Dec 05 '18 at 17:51
  • So if you comment out the `gridView_CustomRowFilter` method and or code, there's no problem with showing the data in the grid correct? – Trevor Dec 05 '18 at 18:54
  • @Çöđěxěŕ No , if I disable that event everything display almost instantly. But I need that event !!! – Adriano Dec 05 '18 at 18:57
  • @Adriano it's happening because it does it for each record which gives more flexibility to control visibility in a view... Also why are you checking the state for each row to either show or hide, can't you remove the data first before assigning your datasource? Another option is you can create a property that you could bind to for each row... – Trevor Dec 05 '18 at 23:16
  • https://documentation.devexpress.com/WindowsForms/8398/Controls-and-Libraries/Data-Grid/Data-Binding/Large-Data-Sources-Server-and-Instant-Feedback-Modes#limitations I would recommend reading this... which specifically states "Filtering rows using the CustomRowFilter is not recommended" in large data sources... – Trevor Dec 05 '18 at 23:25

0 Answers0