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

Multi column combo data binding

5 Answers 152 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Carol Watson
Top achievements
Rank 1
Carol Watson asked on 16 Feb 2010, 07:36 PM
Hi... I am using the Q3 2009 version of your controls and I am trying to understand your data binding.  What I would like to do is to bind the combo to a single field in one table but display a list based on another.   I am just migrating to the telerik controls and .Net and in other ActivieX controls (non telerik) they had two properties that allows me to accomplish this.  They combo boxes had a RowSource and a DataSource.  The model was simple for me to understand.  I would bind the control to the data source but, use the row source for the list.  For the Telerik control I have noticed that it only has the Data source property.  And Until that is set , I cannot set the Value Member or the Display Member properites.
Please can you help me to accomplish this?  Where am I going wrong or not underdstanding

Thank you.

5 Answers, 1 is accepted

Sort by
0
Accepted
Victor
Telerik team
answered on 17 Feb 2010, 08:51 AM
Hello Carol Watson,

Thank you for writing. From what you wrote I understand that you need to populate one combo box with some data but display different data. I am afraid that the data binding mechanism in windows forms does not work this way. Please have a look at the MSDN articles related to data binding. You should also do some research on the System.Data namespace as it provides the primary means of storing data, namely the DataSet, DataTable, DataView (the data view allows filtering) and the TableAdapter classes. The data binding of our controls is not special and it works just as the way it works in the standard Microsoft Windows Forms controls.

Kind regards,
Victor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Carol Watson
Top achievements
Rank 1
answered on 18 Feb 2010, 03:18 PM
Sorry... I should have perhaps provided an example.  Imagine if you will two tables, One, contains customer orders and and another customers.  The customer orders table contains a Customer ID field as does the customer table. 


I have a form that displays all the customer orders ... all the controls on that form are bound to that table.  I would like to bind the combo box specifically to the customerID on the customerOrders table so it updates that table.  I would however like the list in the dropdown to display the list of customers available in the customers table, displaying the Customer Name but storing the CustomerID. 

My older ActiveX controls seperated the two by having a datasource and a rowsource property.   For me, that was simple to understand.  I have noticed with your .NET controls (I am not sure that this is something common to .NET) doesn't seperate the two and as such I have been struggling to 'figure out' how to accomplish the same task using your Multicolumn combo box.
0
Carol Watson
Top achievements
Rank 1
answered on 19 Feb 2010, 02:53 PM
Please disregard last post.  Your reply was the answer.  Thank you very much for the assist.
0
Tajes
Top achievements
Rank 1
answered on 17 Nov 2010, 09:46 AM
Hello,
    I'm trying to do exactly the same, but I use OpenAccess ORM to provide data. I have a BindingSource to binding the form's controls and I set  the BindingSource.DataSource to myContext.MyPersistentClass.getall<MyPersistentClass>(). I'm also trying to change a field of this class, getting it from another Persistent class (another "table"). These two classes/tables have a relationship provide by OpenAccess and implemented by a foreing key constraint in the database.
     I looked up in the links above, but I don't use DataSet, nor DataTable, nor TableAdapter. What can I do?

Thanks.
0
Svett
Telerik team
answered on 22 Nov 2010, 11:10 AM
Hello Iván Tajes,

As my colleague mentioned, the data binding mechanism in windows forms does not support populating one combo box with some data but display different data. Please have a look at the MSDN articles related to data binding. If you want to sort the data you can simply use the sort mechanism provided by OpenAccess. You can read more about this in this documentation article. Another approach is to set the Sorted property of RadComboBox control:

combo.Sorted = Telerik.WinControls.Enumerations.SortStyle.Ascending;

Should you have any further questions, I will be glad to help.

Best wishes,
Svett
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Carol Watson
Top achievements
Rank 1
Answers by
Victor
Telerik team
Carol Watson
Top achievements
Rank 1
Tajes
Top achievements
Rank 1
Svett
Telerik team
Share this question
or