none
EF5 Sorting doesn't work for me when databinding RRS feed

  • Question

  • Hi, in the process of converting a VB.NET Windows Forms project from ObjectContext to EF5 DbContext.

    When loading up a DataGridView like so:

            m_Context = New Entities
            Dim activities = m_Context.Activities.Where(Function(a) a.JobID = 2321).ToList
            ActivityBindingSource.DataSource = activities

    The grid loads the expected data. The columns' SortMode = Automatic. The grid will not sort when clicking on the column headers. I also bound to a BindingList with .ToBindingList but no banana.

    Can someone tell what's wrong? Thanks!

    Wednesday, August 22, 2012 9:43 PM

Answers

  • Never mind, I figured it out:

    m_Context = New Entities
    Dim activities = m_Context.Activities.Where(Function(a) a.JobID = 2321)
    activities.Load
    ActivityBindingSource.DataSource = m_Context.Activities.Local.ToBindingList

    • Marked as answer by Alexander Sun Friday, August 24, 2012 1:26 AM
    Thursday, August 23, 2012 2:29 PM