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

how to select the item in radcombobox based on item value ?

3 Answers 1302 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Hemanth
Top achievements
Rank 1
Hemanth asked on 02 Jan 2013, 12:24 PM
Hi,

I am using radcombobox in my project, bind the combo box using page methods see this link.(last method) Working fine to display the items based on loadondemond, but after save the data when i am trying to edit  i am assigning to radcombobox based on item value , but it is not working properly, because radcombobox items are not loaded .

 my code is
i am trying bellow two ways

1) RadComboBox4.SelectedValue = dr["AgentID"].ToString();

2) RadComboBox4.FindItemByValue(dr["AgentID"].ToString()).Selected = true;

the second method  showing the error , selecteditem and selectedindex always shows null and -1. 

please can any one help me to come out this problem .

Thanks,
hemanth

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jan 2013, 09:20 AM
Hi Hemanth,

By design when a RadComboBox with enabled Load-On-Demand feature is loaded - it is empty and it has no items. Load-On-Demand fires and populates the control with data if the user types in the input area or clicks on the drop-down toggle image when there are no items in the RadComboBox.

Additionally the RadComboBox items are not accessible on the server-side when loading them on demand and that is why they cannot be accessed using the server-side FindItemByText / Value methods - please take a look at this help article.

Hope this helps.

Regards,
Princy.
0
Rajesh
Top achievements
Rank 1
answered on 17 Oct 2014, 02:44 PM
Hi Telerik,

I too have the same problem, I have a search page where all the records will be listed and on clicking a record, the details page gets loaded with the selected record data and there is a city dropdown with load on demand feature and I am adding an item to the RadComboBox with the below code. And I'm able to set the selected record city. But the problem is when I click on the Combo I see the City added for the selected record twice. And I understood that it is by design. Is there a way to clear the item. Please help me in this regard.
var city = new RadComboBoxItem
{
     Text = Convert.ToString(city),
     Value = Convert.ToString(cityId)
};
rcbCity.Items.Add(city);
rcbCity.SelectedValue = Convert.ToString(cityId); 




0
Plamen
Telerik team
answered on 21 Oct 2014, 10:24 AM
Hello,

You can refer to this help topic where one way to clear the selection of RadComboBox is provided.

Hope this will help you solve the issue. 

Regards,
Plamen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
ComboBox
Asked by
Hemanth
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Rajesh
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or