We are using the windows application. In Datagrid we implement a style as Multi select dropdown for a particular cell using ValueList in vb.net. Selected items not showed in dropdown text, only one item will showed even we selected multiple items and also we get into the cell again, no items are selected which i selected earlier.
Please provide us sample project in vb.net for the same.
Hello Thangachan,
Please modify the type of ValueList column in your UltraGrid to an object array in order to show multiple values in its cells. I.e. if the column type is int/string it can only show one value so modifying it to an object array type will allow it show multiple values in its cell. Please refer to the CheckListSettings sample at this link to see how selection can be persisted upon clicking in the cell.
https://es.infragistics.com/help/winforms/wincomboeditor-selecting-multiple-values-within-wincomboeditor
Please let me know if you have any questions.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer
The solution which you have given is normal combo editor.
We are using multi select drop down list inside the UltraWinGrid, so please provide sample project for the in VB.NET.
Please refer to the VB.net sample provided at the below link on how to implement multi select dropdown for the UltraGrid.
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7698
However, we added CheckListSettings property for the UltraCombo and UltraComboEditor in Infragistics for Windows Forms 2009 Vol2 version and above, which allows you to multi select the values within it without writing any custom code. There is a possibility of adding UltraCombo to an UltraGrid by doing something like this:Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.BindUltraCombo()End Sub
Private Sub BindUltraUltraCombo()
Dim dt As DataTable = New DataTable() dt.Columns.Add("ID", GetType(Integer)) dt.Columns.Add("DisplayText", GetType(String))
dt.Rows.Add(New Object() {1, "A"}) dt.Rows.Add(New Object() {2, "B"}) dt.Rows.Add(New Object() {3, "C"}) dt.AcceptChanges()
Me.UltraCombo1.SetDataBinding(dt, Nothing) Me.UltraCombo1.ValueMember = "ID" Me.UltraCombo1.DisplayMember = "DisplayText"End Sub
Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout e.Layout.Bands(0).Columns("Int32 1").ValueList = Me.UltraCombo1End Sub
You can refer to this link where this approach is explained. When using a ValueList in a Grid column set its type to Object array in order to allow it to render multiple values. What I was suggesting in my previous post was to use an UltraCombo instead of a multi select dropdown as it has the CheckListSettings (multiselect) functionality built into it. Then embed the UltraCombo into the Grid column by doing something like above.
You can follow any of these approaches to achieve this.
Please let me know if I may be of further assistance.
Hi,
We have used Value list in the combo box editor to bind values inside the WinGrid, the above solution is working for us.
Can you please provide the sample project in VB.NET and it is very critical.
Please clarify which of the solutions that I suggested previously worked for you. What is the data type of your DataSource? Are you assigning an UltraCombo to the ValueList property of your Grid column or are you type casting in some way to assign an UltraComboEditor to the column’s ValueList property? Either way you can achieve this. For example, you can do something like this to enable multiple selection in UltraCombo or UltraComboEditor:
Public Class Form1 Private _table As DataTable Public Sub New() Me.InitializeComponent() ' Bind the UltraComboEditor control to a data source. Me.ultraComboEditor1.DisplayMember = "Display" Me.ultraComboEditor1.ValueMember = "Value" Me.ultraComboEditor1.DataSource = Me.Table ' Bind the UltraCombo control to a data source. Me.ultraCombo1.DisplayMember = "Display" Me.ultraCombo1.ValueMember = "Value" Me.ultraCombo1.DataSource = Me.Table End Sub Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.OnLoad(e) ' Set up the UltraComboEditor to show checkboxes next to the items, with middle-left alignment Me.ultraComboEditor1.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox Me.ultraComboEditor1.CheckedListSettings.CheckBoxAlignment = ContentAlignment.MiddleLeft ' Set up the UltraCombo to show its checkbox column on the left, with the checkbox middle-center aligned Me.ultraCombo1.CheckedListSettings.CheckStateMember = "Selected" Dim column As UltraGridColumn = Me.ultraCombo1.DisplayLayout.Bands(0).Columns("Selected") Dim checkEditor As CheckEditor = New CheckEditor() checkEditor.CheckAlign = ContentAlignment.MiddleCenter column.Editor = CheckEditor column.Header.VisiblePosition = 0 ' Set up both controls to get their value from the checked items/rows Me.ultraComboEditor1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems Me.ultraCombo1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems ' Set up both controls so that clicking anywhere on the item changes the check state, ' and does not close the dropdown until the enter/escape key is pressed Me.ultraComboEditor1.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item Me.ultraCombo1.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item ' Set up both controls to use a custom list delimiter Me.ultraComboEditor1.CheckedListSettings.ListSeparator = " / " Me.ultraCombo1.CheckedListSettings.ListSeparator = " / " ' Handle the ValueChanged event for each control AddHandler Me.ultraComboEditor1.ValueChanged, AddressOf Me.OnValueChanged AddHandler Me.ultraCombo1.ValueChanged, AddressOf Me.OnValueChanged End Sub Private Sub OnValueChanged(ByVal sender As Object, ByVal e As EventArgs) ' Get the list of values from each control, and a reference ' to their IValueList implementation so we can get the text ' for each item. Dim values As System.Collections.IList = Nothing Dim valueList As IValueList = Nothing If sender Is Me.ultraComboEditor1 Then values = Me.ultraComboEditor1.Value valueList = Me.ultraComboEditor1.Items.ValueList ElseIf sender Is Me.ultraCombo1 Then values = Me.ultraCombo1.Value valueList = Me.ultraCombo1 End If ' Iterate the list of values and output each one to the console If Not values Is Nothing Then Dim index As Int32 = -1 Dim value As Object For Each value In values Dim text As String = valueList.GetText(value, index) Console.WriteLine(String.Format("Text = '{0}', Value = '{1}'", text, value)) Next End If End Sub Private ReadOnly Property Table() As DataTable Get If Me._table Is Nothing Then Me._table = New DataTable() Me._table.Columns.Add("Value", GetType(Object)) Me._table.Columns.Add("Display", GetType(String)) Me._table.Columns.Add("Selected", GetType(Boolean)) Me._table.Rows.Add(New Object() {1, "One", False}) Me._table.Rows.Add(New Object() {2, "Two", False}) Me._table.Rows.Add(New Object() {3, "Three", False}) Me._table.Rows.Add(New Object() {4, "Four", False}) Me._table.Rows.Add(New Object() {5, "Five", False}) End If Return Me._table End Get End PropertyEnd Class
Public Sub New()
Me.InitializeComponent()
' Bind the UltraComboEditor control to a data source. Me.ultraComboEditor1.DisplayMember = "Display" Me.ultraComboEditor1.ValueMember = "Value" Me.ultraComboEditor1.DataSource = Me.Table
' Bind the UltraCombo control to a data source. Me.ultraCombo1.DisplayMember = "Display" Me.ultraCombo1.ValueMember = "Value" Me.ultraCombo1.DataSource = Me.Table
End Sub
Protected Overrides Sub OnLoad(ByVal e As System.EventArgs) MyBase.OnLoad(e)
' Set up the UltraComboEditor to show checkboxes next to the items, with middle-left alignment Me.ultraComboEditor1.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox Me.ultraComboEditor1.CheckedListSettings.CheckBoxAlignment = ContentAlignment.MiddleLeft
' Set up the UltraCombo to show its checkbox column on the left, with the checkbox middle-center aligned Me.ultraCombo1.CheckedListSettings.CheckStateMember = "Selected" Dim column As UltraGridColumn = Me.ultraCombo1.DisplayLayout.Bands(0).Columns("Selected") Dim checkEditor As CheckEditor = New CheckEditor() checkEditor.CheckAlign = ContentAlignment.MiddleCenter column.Editor = CheckEditor column.Header.VisiblePosition = 0
' Set up both controls to get their value from the checked items/rows Me.ultraComboEditor1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems Me.ultraCombo1.CheckedListSettings.EditorValueSource = EditorWithComboValueSource.CheckedItems
' Set up both controls so that clicking anywhere on the item changes the check state, ' and does not close the dropdown until the enter/escape key is pressed Me.ultraComboEditor1.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item Me.ultraCombo1.CheckedListSettings.ItemCheckArea = ItemCheckArea.Item
' Set up both controls to use a custom list delimiter Me.ultraComboEditor1.CheckedListSettings.ListSeparator = " / " Me.ultraCombo1.CheckedListSettings.ListSeparator = " / "
' Handle the ValueChanged event for each control AddHandler Me.ultraComboEditor1.ValueChanged, AddressOf Me.OnValueChanged AddHandler Me.ultraCombo1.ValueChanged, AddressOf Me.OnValueChanged
Private Sub OnValueChanged(ByVal sender As Object, ByVal e As EventArgs)
' Get the list of values from each control, and a reference ' to their IValueList implementation so we can get the text ' for each item. Dim values As System.Collections.IList = Nothing Dim valueList As IValueList = Nothing
If sender Is Me.ultraComboEditor1 Then values = Me.ultraComboEditor1.Value valueList = Me.ultraComboEditor1.Items.ValueList
ElseIf sender Is Me.ultraCombo1 Then values = Me.ultraCombo1.Value valueList = Me.ultraCombo1 End If
' Iterate the list of values and output each one to the console If Not values Is Nothing Then
Dim index As Int32 = -1
Dim value As Object For Each value In values Dim text As String = valueList.GetText(value, index) Console.WriteLine(String.Format("Text = '{0}', Value = '{1}'", text, value)) Next
End If End Sub
Private ReadOnly Property Table() As DataTable Get If Me._table Is Nothing Then Me._table = New DataTable() Me._table.Columns.Add("Value", GetType(Object)) Me._table.Columns.Add("Display", GetType(String)) Me._table.Columns.Add("Selected", GetType(Boolean))
Me._table.Rows.Add(New Object() {1, "One", False}) Me._table.Rows.Add(New Object() {2, "Two", False}) Me._table.Rows.Add(New Object() {3, "Three", False}) Me._table.Rows.Add(New Object() {4, "Four", False}) Me._table.Rows.Add(New Object() {5, "Five", False}) End If
Return Me._table End Get End PropertyEnd Class
I have looked at the sample you sent us through your email to developer support team. I will modify it to demonstrate how multiple selection can be enabled in UltraComboEditor and will send that to you by end of day tomorrow.
You can refer to the attached sample on how to enable multiple selection on a Grid Cell with its Column's EditorComponent set to UltraComboEditor.