Control will not collapse prior to task with UI lock

2 posts, 1 answers
  1. Neal
    Neal avatar
    1 posts
    Member since:
    Jan 2011

    Posted 18 Feb 2011 Link to this post

    I am using a CommandBarDropDownList to trigger a refresh of the bindingsource for a GridView.  The linq query takes a little while to execute, so the UI gets frozen, which is ok.  Prior to executing the query, I would like the dropdownlist to fully collapse.  I attempt to use application.doevents, but it still will not collapse until the query runs.  See snippet below.

    Thanks,
    Neal

    EDIT:  Tried with regular DropDownList (not in commandbar) and same behavior.  Tried with winforms combobox and the control successfully collapses.

     

    Private Sub CommandBarDropDownList1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CommandBarDropDownList1.TextChanged
        UpdateGrid()
    End Sub
    Private Sub UpdateGrid()
        Application.DoEvents()
        Me.Cursor = Cursors.WaitCursor
        Dim db As New DAL_DataContext
        db.Log = Console.Out
        Dim qryRep = (From item In db.RepSaleDetails Where item.RepSaleHeader.Date.Value.Year = CommandBarDropDownList1.Text Select _
                  Descr = item.RepSaleHeader.Rep.LastName, _
                  Amount = CInt(item.Qty * item.Price), _
                  Month = item.RepSaleHeader.Date.Value.Month)
        Dim qryCust = From item In db.CustSaleDetails Where item.CustSaleHeader.Date.Value.Year = CommandBarDropDownList1.Text _
                      And item.CustSaleHeader.RefNo >= 3000 Select _
                        Descr = "Ann", _
                        Amount = CInt(item.Qty * item.Price), _
                        Month = item.CustSaleHeader.Date.Value.Month
        Dim qryInternet = From item In db.CustSaleDetails Where item.CustSaleHeader.Date.Value.Year = CommandBarDropDownList1.Text _
                          And item.CustSaleHeader.RefNo < 3000 Select _
                          Descr = "Ann Internet", _
                          Amount = CInt(item.Qty * item.Price), _
                          Month = item.CustSaleHeader.Date.Value.Month
        Dim qryAll = qryRep.Concat(qryCust).Concat(qryInternet)
        Dim MyTable = qryAll.GroupBy(Function(i) i.Descr).Select(Function(g) New TrendAnnual With _
                 {.Descr = g.Key, _
                  .Tot = g.Sum(Function(c) c.Amount), _
                  .Jan = g.Where(Function(c) c.Month = 1).Sum(Function(d) d.Amount), _
                  .Feb = g.Where(Function(c) c.Month = 2).Sum(Function(d) d.Amount), _
                  .Mar = g.Where(Function(c) c.Month = 3).Sum(Function(d) d.Amount), _
                  .Apr = g.Where(Function(c) c.Month = 4).Sum(Function(d) d.Amount), _
                  .May = g.Where(Function(c) c.Month = 5).Sum(Function(d) d.Amount), _
                  .Jun = g.Where(Function(c) c.Month = 6).Sum(Function(d) d.Amount), _
                  .Jul = g.Where(Function(c) c.Month = 7).Sum(Function(d) d.Amount), _
                  .Aug = g.Where(Function(c) c.Month = 8).Sum(Function(d) d.Amount), _
                  .Sep = g.Where(Function(c) c.Month = 9).Sum(Function(d) d.Amount), _
                  .Oct = g.Where(Function(c) c.Month = 10).Sum(Function(d) d.Amount), _
                  .Nov = g.Where(Function(c) c.Month = 11).Sum(Function(d) d.Amount), _
                  .Dec = g.Where(Function(c) c.Month = 12).Sum(Function(d) d.Amount)})
        GridBindingSource.DataSource = MyTable.OrderBy(Function(i) i.Descr)
        db.Dispose()
        Me.Cursor = Cursors.Default
    End Sub

     

     

     

  2. Answer
    Peter
    Admin
    Peter avatar
    1148 posts

    Posted 23 Feb 2011 Link to this post

    Hello Neal,

    Thank you for writing.

    I would like to suggest closing DropDownList's Popup manually before running your database query. There is not built-in implementation which closes RadDropDownList on text change. You should also turn off DropDownList's Popup FadeOut animation.

    commandBarDropDownList1.DropDownListElement.Popup.FadeAnimationType = FadeAnimationType.None;

    Please refer to the attached project.

    I hope this helps.

    Best wishes,
    Peter
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top