This question is locked. New answers and comments are not allowed.
Hello,
i have a very weird issue. Everytime when i select an item from the Combobox the SelectedText value only changes at the second time when the SelectedIndexChanged event is fired. So i have to select the itme twice until i get the Value i want to have. Urgent Problem!!
i have a very weird issue. Everytime when i select an item from the Combobox the SelectedText value only changes at the second time when the SelectedIndexChanged event is fired. So i have to select the itme twice until i get the Value i want to have. Urgent Problem!!
4 Answers, 1 is accepted
0
Hello Kerstin,
The SelectedText property returns the string that represents the currently selected text in the text box part of the combobox. To get always the proper text value of the currently selected item you should use instead:
((RadComboBoxItem)SelectedItem).Text.
If you need further assistance, please write us back and give us some more information about your case.
Sincerely yours,
Georgi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
The SelectedText property returns the string that represents the currently selected text in the text box part of the combobox. To get always the proper text value of the currently selected item you should use instead:
((RadComboBoxItem)SelectedItem).Text.
If you need further assistance, please write us back and give us some more information about your case.
Sincerely yours,
Georgi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Chase Florell
Top achievements
Rank 1
answered on 17 Mar 2008, 06:25 AM
I am having this same issue with the most current version of WinForms.
My code looks like this
But the problem is that I need to change the data in RCB1 twice before RCB2 binds to the new Provider.
My code looks like this
Private Sub RadComboBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadComboBox1.SelectedIndexChanged |
If RadComboBox1.SelectedIndex = 0 Then |
Dim hp As New HouseholdsProvider() |
Dim ds As DataSet = hp.GetHouseholdsAsDataSet() |
RadComboBox2.DisplayMember = "Name" |
RadComboBox2.ValueMember = "ID" |
RadComboBox2.DataSource = ds.Tables(0) |
ElseIf RadComboBox1.SelectedIndex = 1 Then |
Dim op As New OrganizationsProvider() |
Dim ds As DataSet = op.GetHouseholdsAsDataSet |
RadComboBox2.DisplayMember = "Organization" |
RadComboBox2.ValueMember = "ID" |
RadComboBox2.DataSource = ds.Tables(0) |
End If |
End Sub |
But the problem is that I need to change the data in RCB1 twice before RCB2 binds to the new Provider.
0
Chase Florell
Top achievements
Rank 1
answered on 17 Mar 2008, 07:27 AM
Well I think I got it... can anyone confirm that this is the "Right" way to do it?
Notice how I cleared the datasource before binding to a new one.
If RadComboBox1.SelectedIndex = 0 Then |
RadComboBox2.DataSource = Nothing |
Dim hp As New HouseholdsProvider() |
Dim ds As DataSet = hp.GetHouseholdsAsDataSet() |
RadComboBox2.DisplayMember = "Name" |
RadComboBox2.ValueMember = "ID" |
RadComboBox2.DataSource = ds.Tables(0) |
ElseIf RadComboBox1.SelectedIndex = 1 Then |
RadComboBox2.DataSource = Nothing |
Dim op As New OrganizationsProvider() |
Dim ds As DataSet = op.GetHouseholdsAsDataSet |
RadComboBox2.DisplayMember = "Organization" |
RadComboBox2.ValueMember = "ID" |
RadComboBox2.DataSource = ds.Tables(0) |
End If |
Notice how I cleared the datasource before binding to a new one.
0
Hi Chase Florell,
I am not quite sure that your issue is the same as with the previous one related to SelectedText. Otherwise, your last approach seems to be ok.
The previous would probably not work because you assign a new value to the DisplayMember property before changing the datasource while the combobox is still bound to the old one. Furthermore, it not needed to set ValueMember twice with the same value.
If you have any other questions, I will be glad to help you.
Kind regards,
Georgi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I am not quite sure that your issue is the same as with the previous one related to SelectedText. Otherwise, your last approach seems to be ok.
The previous would probably not work because you assign a new value to the DisplayMember property before changing the datasource while the combobox is still bound to the old one. Furthermore, it not needed to set ValueMember twice with the same value.
If you have any other questions, I will be glad to help you.
Kind regards,
Georgi
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center