Multi-Select combo in UltraWinGrid
New DiscussionI need to use a multi-select combo in a grid. I assume that the cell can’t be databound due to the fact it is multi-select. My problem is when the grid is bound to a datasource, how do I select the appropriate entries in the grid for each row? I think the code would go in the InitializeRow event, but I don’t know how to reference the control. Also, when the data needs to be saved, I don’t know how to reference the control either.
To get the combo in the grid I have done the following: (Windows form project using 17.2)
Added an UltraComboEditor to the form
Added the following code to the form load event
cbeContact.DataSource = _dtContacts;
cbeContact.ValueMember = “Id”;
cbeContact.DisplayMember = “NameTitle”;
cbeContact.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList;
cbeContact.CheckedListSettings.CheckBoxStyle = Infragistics.Win.CheckStyle.CheckBox;
cbeContact.CheckedListSettings.EditorValueSource = Infragistics.Win.EditorWithComboValueSource.CheckedItems;
Added the following code to the grids InitializeLayout event
e.Layout.Bands[2].Columns.Insert[7,”ContactId2″];
e.Layout.Bands[2].Columns[“ContactId2”].Hidden = false;
e.Layout.Bands[2].Columns[“ContactId2”].Header.Caption = “Contact/Ship To”;
e.Layout.Bands[2].Columns[“ContactId2”].Width = 180;
e.Layout.Bands[2].Columns[“ContactId2”].EditorComponent = cbeContact;