How to Select Multiple Items in a Dropdown List of cell in GridGroupingControl
How to Select Multiple Items in a Dropdown List in GridGroupingControl
I have a setup where a cell in the GridGroupingControl displays a dropdown list. The issue is that this list only allows selecting a single value. Now, I want to modify it so that the dropdown includes checkboxes, allowing me to select multiple items freely.
Below is my initial code and an illustrative image.
DataTable dt = new DataTable();
private void CreateDataTableMaChamCongDTO()
{
dt = new DataTable();
dt.Columns.Add("Mã chấm công", typeof(System.String));
dt.Columns.Add("Tên chấm công", typeof(System.String));
dt.Columns.Add("Tỷ lệ tính lương", typeof(System.Decimal));
dt.Columns.Add("Tỷ lệ trừ phép", typeof(System.Decimal));
foreach (var row in Data.MaChamCongDTO)
{
dt.Rows.Add(row.MaChamCong_ud, row.MaChamCong_nm, row.TyLeTinhLuong, row.TyLeTruPhep);
}
}
grd.TableDescriptor.VisibleColumns.Add(columnName);
grd.TableDescriptor.Columns[columnName].HeaderText = _header;
grd.TableDescriptor.Columns[columnName].Width = 50;
grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.CharacterCasing = CharacterCasing.Upper;
//Assigning the column cell types as GridListControl
grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl;
//Enables Autocomplete
grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.AutoCompleteInEditMode = GridComboSelectionOptions.AutoSuggest;
grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.ShowButtons = GridShowButtons.ShowCurrentCell;
//Add DataSource
grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.DataSource = dt;
grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.DisplayMember = "Mã chấm công";
grd.TableDescriptor.Columns[columnName].Appearance.AnyRecordFieldCell.ValueMember = "Mã chấm công";
Based on the information provided, we understand that you require a multi-select dropdown list in GridGroupingControl. Currently, GridGroupingControl does not natively support this feature. However, you can achieve the desired functionality by customizing the dropdown through an overridden dropdown renderer.
Attachment: GridGroupingControl_Demo_4b384745.zip
Malini Selvarasu
You can achieve multi-selection by using a GridComboBoxListBoxPart with checkboxes or a GridDropDownListCellModel. Setting ExclusiveChoice to false allows multiple selections. Have you tried handling selected values as a comma-separated string?
Based on the information provided, you have successfully achieved multi-selection using a GridComboBoxListBoxPart.
My problem is also solved, thank you so much.
Malini Selvarasu
My problem is also solved, thank you so much. scmapk
- 8 Replies
- 5 Participants
-
SL School Liter
- Feb 19, 2025 01:18 AM UTC
- Apr 13, 2025 06:01 PM UTC