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

How to programmatically populate a multicolumn combobox

2 Answers 52 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Gaston
Top achievements
Rank 1
Gaston asked on 01 Jun 2014, 02:28 PM
I am trying to programmatically populate a multicolumn combobox after user selected another customer from the previous combo box
this is the sample of the code.
01.private void RadMultiColumnComboBox3SelectedIndexChanged(object sender, EventArgs e)
02.       {
03.           string a;
04.           a = string.Format("{0}", radMultiColumnComboBox3.EditorControl.Rows[radMultiColumnComboBox3.SelectedIndex].Cells["customerID"].Value);
05.           Int32 b;
06.           Int32.TryParse(a, out b);
07.           radMultiColumnComboBox4.Enabled = true;
08.           OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|/RoadRunnerDB.mdb");
09.           string cmdStr = string.Format("Select * FROM addressList WHERE customerID = {0}", b);
10. 
11.           try
12.           {
13.               conn.Open();
14.               OleDbCommand cmd = new OleDbCommand(cmdStr, conn);
15.               OleDbDataReader reader = cmd.ExecuteReader();
16.               //fill the grid!??
17.           }
18.           catch (Exception ex)
19.           {
20.               MessageBox.Show(ex.Message);
21.           }
22.       }


2 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 04 Jun 2014, 02:48 PM
Hello Gaston,

Thank you for writing.

You can load the data from the reader as follows:
radMultiColumnComboBox2.EditorControl.MasterTemplate.LoadFrom(reader);

Detailed information is available in the following article: Binding to DataReader.

Please let me know if there is something else I can help you with.

Regards,
Dimitar
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Gaston
Top achievements
Rank 1
answered on 08 Jun 2014, 06:26 AM
Thank you it worked like a charm! :D
Tags
MultiColumn ComboBox
Asked by
Gaston
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Gaston
Top achievements
Rank 1
Share this question
or