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

[Solved] Returned value different than visible text

4 Answers 115 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 23 Jan 2008, 01:53 PM
I have a database table with numbers, to each number a description is available. In a combobox I want to show only the description. If I access the value of the currently selected item I want to have the number instead of the description returned. This is equivalent to access combbox. There I can define a bound column. There is no need to show the column in the list it must only be available in SELECT. When I set bound column I can read a different value than the one is shown as text. Is this possible with radcombbox and if so how?

4 Answers, 1 is accepted

Sort by
0
Rosi
Telerik team
answered on 24 Jan 2008, 03:31 PM
Hello Markus,

Thanks for your interest in our controls.

Every RadComboBoxItem has a Value property and Text property. Text property is this which is displayed.

You can use Value property instead bound column.
For an example you can set this properties with values from database as follows:
combo.DataTextField = "One";
combo.DataValueField = "Two";
combo.DataSource = table;
combo.DataBind();


In this example "One" and "Two" represents column from the database.

Regards,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 25 Jan 2008, 10:37 AM
Thanks for inmformation. The combbox itself has no value property so how should I read the value defined in "DataValueField"? I also tried "SelectedItem" but after selecting an item from list the property is "Nothing".
0
Rosi
Telerik team
answered on 25 Jan 2008, 11:25 AM
Hi Markus,

RadComboBox has a SelectedValue property which you can use. Also you can use Value property of the SelectedItem. SelectedItem works as expected on our side.

If this does not help you, please open a support ticket and send us a simple and running project which illustrates the problem. We will test ti locally and provide you with more specific instructions.

Best wishes,
Rosi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 25 Jan 2008, 11:39 AM
Thnaks for great support! With "SelectedValue" I get it work.
Tags
ComboBox
Asked by
Markus
Top achievements
Rank 1
Answers by
Rosi
Telerik team
Markus
Top achievements
Rank 1
Share this question
or