Hello,
I have a context menu with a popup menu on it. At runtime we programmatically add items to the popup menu. The items are retrieved from the database in the order we want them to display from newest to oldest. We loop through them and add items based on them to the popup menu. I've even set a defaultview sort on the datatable the rows live in. Instead of coming out
321
the menu is populated with
2,3,1
Unless ... I put a breakpoint on the code where we add the items. In which case it _sometimes_ behaves the way I want it to. There is no alternate code path and the datatable is filled with the same, presorted data every time.
Here's the code. The only change is the name of the tables/columns
Dim CurrentId As Integer
CurrentId = dtTmp.Rows(x)("IDColumn")
If Not Me.utmContextMenu.Tools.Exists("T" & CurrentId .ToString) Then
Dim miItem As New Infragistics.Win.UltraWinToolbars.ButtonTool("T" & CurrentId .ToString)Me.utmContextMenu.Tools.Add(miItem)
End If
Next
Any ideas? Oh yeah, version is 5.3
Per your instructions I did a debug.writeline. The items are added in the proper order, it's a toolbar issue. Thanks for your help.
I'm not sure if this is a toolbars issue. Try to do a Debug.WriteLine to write out the item you are adding when you create a menu item for it. If the output window has the items in the right order but the menu does not, it is an issue with the toolbars manager. If not, it is an issue with the database query. If it is an issue with the toolbars manager, you will have to upgrade to a later version to fix the issue as 5.3 is no longer supported.