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

Problem with DataTextField and DataValueField

3 Answers 251 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
bharat kumar
Top achievements
Rank 1
bharat kumar asked on 26 Apr 2010, 05:17 PM

Hi,

i have one combobox i.e.

 <telerik:RadComboBox ID="Fund" runat="server"
                            DataSourceID="Source" DataTextField="Code" DataValueField="Currency" 
                            Width="55px" Skin="Outlook" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged1" SelectedValue='<%# Bind("Fund") %>'
                            BorderWidth="1px">
                       </telerik:RadComboBox> 

now the dropdown is populating with 3 values on page load.e.g 1 , 2 and 3
whenever i am selecting 1 and 2 it is ok but when selecting 3 it automatically takes 1.
strange problem but i dont have any clue why this is happening.
but if  replace DataValueField = "currency" with DataValueField="code" then it is working absolutely fine.

please help me as i dont have any clue why it is behaving like so.

waiting for reply.

thanks in advance.

3 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 27 Apr 2010, 12:14 PM
Hi bharat kumar,

I can not see the DataSource to which you are binding the RadComboBox. However I guess the "currency " DataValueField is not with unique values. Please take a look at this help topic about RadComboBox selecting a different item

Hope this helps.

All the best,
Veronica Milcheva
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
bharat kumar
Top achievements
Rank 1
answered on 27 Apr 2010, 12:51 PM
thank you very much.
yes you are right and the value field do not have unique values.

but is it possible to have two value field or something by which this problem is handled.
otherwise i have to change the code and do some work around.

thanks in advance.


0
Veronica
Telerik team
answered on 29 Apr 2010, 10:41 AM
Hi bharat kumar,

Try using the CurrencyID instead of it's name in the DataValueField. Of course you should check if your Id-s are unique.

Hope this helps. 

Regards,
Veronica Milcheva
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.
Tags
ComboBox
Asked by
bharat kumar
Top achievements
Rank 1
Answers by
Veronica
Telerik team
bharat kumar
Top achievements
Rank 1
Share this question
or