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

Binding objects to comboBoxes

1 Answer 43 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Miguel
Top achievements
Rank 1
Miguel asked on 30 Jun 2009, 11:27 AM
Hi,
I'n testing OpenAccess to be used in our next application version.
The proble we found is we can't assign object references to RadComboBox.
We can load the combo box, and get the selected text value or integer value, but we cant get the selected object to be assigned to another object attribute.
Example:

class Project
{
...
...
..
public Country country;

}

class Country
{
    public String code;
    public String name;
}


The country class has an attribute of class Country and the web page has a list of contries in a RadComboBox.
Then ComboBox items are loaded correctly, but when we need to store the project in the database, assigning the selected contry to the project.Contry attribute, we must query the database to the object reference using the text value of the selected combobox item.

Is there any way we can get the selected object reference directly from the RadComboBox with out a query?

Thanks

Miguel

1 Answer, 1 is accepted

Sort by
0
Alexander
Telerik team
answered on 01 Jul 2009, 03:46 PM
Hello Miguel ,

I am afraid this is not possible as the ComboBox does not keep the whole objects. But using a query to retrieve the object should not bother you. The object should be already in memory and it will not be fetched again from the database if you request it from the same object scope which you use for getting the binding collection. The scope will search for it in memory and if it does not find it there, it will request it from the database. Hope that helps.

Regards,
Alexander
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
Miguel
Top achievements
Rank 1
Answers by
Alexander
Telerik team
Share this question
or