Posted 26 May 2022, 5:46 am EST
My customer needs to put a multiselection into all the cell of one column his flexgrid.
This is the portion of my code.
[i]string comboIdValue = “Id”;
string comboIdText = “Name”;
string mycomboTable = “ANA_MEASURES”;
string comboQuery = “SELECT " + comboIdValue + " ,” + comboIdText + " FROM ( " + mycomboTable + “) cb”;
switch (comboTable.connection_type.ToLower())
{
case “microsoft sql server”:
dtCombo = microsoftUtil.getDataTable(comboTable.connection_string, comboQuery, ref comboTableColsName, ref _errorMsg);
break;
case “oracle”:
dtCombo = oracleUtil.getDataTable(comboTable.connection_string, comboQuery, ref comboTableColsName, ref _errorMsg);
break;
case “mysql”:
dtCombo = mysqlUtil.getDataTable(comboTable.connection_string, comboQuery, ref comboTableColsName, ref _errorMsg);
break;
default:
break;
}
_fgTable.Cols[col].Style = _fgTable.Styles[findCol.col_name];
if (findCol.cmb_isMultiselection == 0)
{ // Combobox : is working
Dictionary<string, string> dictionary = new Dictionary<string, string>();
foreach (DataRow row in dtCombo.Rows)
{
string key = (row[0] == DBNull.Value ? “DBNull.Value” : (string)row[0]);
string value = (row[1] == DBNull.Value ? “” : (string)row[1]);
dictionary.Add((string)key, (string)value);
}
_fgTable.Cols[col].DataMap = dictionary;
}
else
{
// Multiselect di C1: works only if I map display and data with the samo column name
C1MultiSelect _multiSelection = new C1MultiSelect();
_multiSelection.BindingInfo.DataSource = dtCombo;
_multiSelection.BindingInfo.DisplayMemberPath = comboIdText; // comboIdValue;
_multiSelection.BindingInfo.DataMember = comboIdValue;
_multiSelection.SelectionMode = C1.Win.Input.SelectionMode.Multiple;
_multiSelection.Separator = findCol.cmb_multiselection_separator; // comma
_multiSelection.DisplayMode = C1.Win.Input.DisplayMode.Text;
_multiSelection.ShowSelectAll = true;
_multiSelection.SelectAllCaption = “Tutti”;
_multiSelection.UnselectAllCaption = “Nessuno”;
_fgTable.Cols[col].Editor = _multiSelection;
}[/i]
The problem is that when i select more than one the multiselection write into the cell the first one description and not all the selection (2,3 and more).
I expect to see all the descripion separeted by comma and not only the first one.
And, at the end, when I save the content of the grid the description is saved instead of value.
I need a help to fix in my code thanks
Alex