This is a migrated thread and some comments may be shown as answers.

Tokenizer as selected Items

1 Answer 68 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Ramachandran
Top achievements
Rank 1
Ramachandran asked on 25 Sep 2017, 09:42 AM

Hi

I have a datatable with id and 4 columns, I am using RadMultiComboBox and 
RadMutliColumnComboBoxSelectionExtender,  My display member is one of the column in the datatable.
I want the display value member is showed in the combobox,  I want the Ids should be tokenised as a string. 

Please help me how to do this? Earliest reply is good.

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 27 Sep 2017, 11:13 AM
 Ramachandran,

Thank you for writing.

You can set the DisplayMember to equal the value of the ValueMember. This way you would be able to display it in the editor of the drop-down. Please note however that this would not allow any customizations fo the text.

If it would fit your setup you can add a field displaying the text the way you like to your data source and then use that field as a DisplayMember. Since this field would only be used to format the text in the editor you might also want to hide the respective column from the underlying grid. This can be done by setting is IsVisible property to false. Please check my code snippet below: 
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
 
        this.radMultiColumnComboBox1.DataSource = this.GetData();
        this.radMultiColumnComboBox1.DisplayMember = "DisplayMemberField";
        this.radMultiColumnComboBox1.ValueMember = "Id";
        this.radMultiColumnComboBox1.EditorControl.Columns["DisplayMemberField"].IsVisible = false;
    }
 
    private DataTable GetData()
    {
        DataTable dt = new DataTable();
 
        dt.Columns.Add("Id", typeof(int));
        dt.Columns.Add("Name", typeof(string));
        dt.Columns.Add("Date", typeof(DateTime));
        dt.Columns.Add("Bool", typeof(bool));
        dt.Columns.Add("DisplayMemberField", typeof(string));
        for (int i = 0; i < 20; i++)
        {
            string v = "Token: Id " + i + " | Name " + i;
            dt.Rows.Add(i, "Name " + i, DateTime.Now.AddDays(i), i % 2 == 0, v);
        }
 
        return dt;
    }
}

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
MultiColumn ComboBox
Asked by
Ramachandran
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or