Hi,
I have scenario where I'm displaying a valuelist (as a dropdownlist) in the cell of the UltraGrid. The valuelist has some values and when user selects any value I show him a message box to confirm. Once the user confirms by pressing OK the Valuelist doesn't close. I'm attaching the code. So could you please let me know how do I close the Valulist.
Private Sub ugEMwithP2_ValueListClick(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CellEventArgs) Handles ugEMwithP2.CellListSelect
Dim l_objDataMgr As New DWSDataManager.DataManager Dim l_intDeedsAppIdNo As Integer = ugEMwithP2.ActiveRow.Cells("id").Value Dim l_intCertIdNo As Integer = ugEMwithP2.ActiveRow.Cells("cert_idno").Value Dim l_intAssignToValue As Integer = CType(ugEMwithP2.ActiveRow.Cells("Assign To").ValueListResolved, Infragistics.Win.ValueList).SelectedItem.DataValue Dim l_intAssignToText As String = CType(ugEMwithP2.ActiveRow.Cells("Assign To").ValueListResolved, Infragistics.Win.ValueList).SelectedItem.DisplayText
If e.Cell.Column.Header.Caption = "Assign To" Then If MsgBox("Are you sure you want to assign this item from the work list to " & l_intAssignToText & " ?", MsgBoxStyle.YesNo, "Assign this item From Worklist?") = MsgBoxResult.Yes Then l_objDataMgr.EMwithP2AssignUsers(1, l_intDeedsAppIdNo, l_intCertIdNo, l_intAssignToValue) Exit Sub End If End If
End Sub
Hello Vikas,
Following the steps you provided and using the code from your code snippet, I was unable to reproduce this issue. I created a small sample project and handled CellListSelect event of the grid. I put the same code as you did in my event handler. The only difference, as I had no access to DWSDataManager, I commented out these two rows:
Dim l_objDataMgr As New DWSDataManager.DataManagerl_objDataMgr.EMwithP2AssignUsers(1, l_intDeedsAppIdNo, l_intCertIdNo, l_intAssignToValue)
When I run my sample, drop down the value list, click on any item and click Ok on the message box the drop down closes. Attached is my sample for you reference.
Can you try to comment the above mentioned rows in your application and let me know if you still face the same issue?
Additionally you may try to call PerformAction over the grid and pass CloseDropdown as paremeter like this:
If MsgBox("Are you sure you want to assign this item from the work list to " & l_intAssignToText & " ?", MsgBoxStyle.YesNo, "Assign this item From Worklist?") = MsgBoxResult.Yes Then l_objDataMgr.EMwithP2AssignUsers(1, l_intDeedsAppIdNo, l_intCertIdNo, l_intAssignToValue) Me.ugEMwithP2.PerformAction(UltraGridAction.CloseDropdown) Exit SubEnd If
Looking forward to your reply.
Hi Milko,
Thanks for your response. I really appreciate your help and time to write the code for me. But I'm still having the problem. The Value List dropdown still doesn't close after click on message box. I commented the call to DataManager as per your advise and also used PerformAction(UltraGridAction.CloseDropdown) but the valuelist still remains open. Is this happening because of the way I'm creating the valuelist. I'm attaching the code. Do I have to do something different here.
Private Sub ugEMwithP2_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles ugEMwithP2.InitializeLayout
Dim vlAssignto As Infragistics.Win.ValueList = New Infragistics.Win.ValueList()
'AssignTo If (Not e.Layout.ValueLists.Exists("AssignToValueList")) Then vlAssignto = e.Layout.ValueLists.Add("AssignToValueList") End If
Dim l_objGUIDR As DataRow With e.Layout.ValueLists("AssignToValueList").ValueListItems .Clear() '.Add(System.DBNull.Value, " ") For Each l_objGUIDR In AppSession.WorklistEMwithP2MetaDataDS.Tables.Item(2).Rows .Add(l_objGUIDR("AssignToPersonIDNo"), l_objGUIDR("AssignToName")) Next End With
e.Layout.Bands(0).Columns("Assign To").ValueList = e.Layout.ValueLists("AssignToValueList")
The way you are populating value list should not affect the closing of the dropdown. Attached is update version of my sample. In my new sample I am populating the dropdown in the same way as you did. When I select a value from the dropdown, dropdown closes, and then a message box pops up. Please run my sample and let me know if you face the same issue.