Urgent- Multicombobox help

2 posts, 0 answers
  1. Truong
    Truong avatar
    2 posts
    Member since:
    May 2012

    Posted 10 Jul 2012 Link to this post

    Hi everyone! Need helps

    I have problem when I am working on multicombobox of teleirk.
    That problem is: I create a linq query "linqquery" and then multicombobox.datasource= linqquery

    i used selected change event. but i did not work when i select first record in the first time.
    att: I selected second record and select first record again -> it worked. I didn't know why?

    Thank you
  2. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 12 Jul 2012 Link to this post

    Hello Truong,

    Thank you for writing.

    I am not sure exactly which event are you referring to, however, a possible reason for the observed behavior is if you are subscribing to the event after you set the DataSource. In order to get the initial change in the selection you need to subscribe prior setting the DataSource:
    public Form1()
    {
        InitializeComponent();
     
        Random r = new Random();
        DataTable table = new DataTable();
        table.Columns.Add("ID", typeof(int));
        table.Columns.Add("Name", typeof(string));
        table.Columns.Add("Bool", typeof(bool));
        table.Columns.Add("DateColumn", typeof(DateTime));
     
        for (int i = 0; i < 10; i++)
        {
            table.Rows.Add(i, "Row " + i, r.Next(10) > 5 ? true : false, DateTime.Now.AddHours(i));
        }
     
     
        radMultiColumnComboBox1.SelectedIndexChanged += new EventHandler(radMultiColumnComboBox1_SelectedIndexChanged);
        this.radMultiColumnComboBox1.DataSource = table;
     
    }
     
    void radMultiColumnComboBox1_SelectedIndexChanged(object sender, EventArgs e)
    {
        //your logic here
    }

    If you continue experiencing this behavior, please provide me with details how can I reproduce it on my end, so I can investigate it and help you with it.

    Greetings,
    Stefan
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top