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

Using RadComboBoxData to Populate RadComboBox

4 Answers 227 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Amit
Top achievements
Rank 1
Amit asked on 30 Aug 2011, 03:42 PM
Hi,

I have a RadComboBoxData object with all the data items. How can use it to populate RadComboBox?

4 Answers, 1 is accepted

Sort by
0
Amit
Top achievements
Rank 1
answered on 30 Aug 2011, 04:23 PM
I acheived the required result using the following code:

protected void rcbPerson_ItemsRequested(object sender, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
       {
           RadComboBoxData d = PersonBO.GetPersons((RadComboBoxContext)e.Context);
           rcbPerson.DataSource = d.Items.AsEnumerable();
           rcbPerson.DataTextField = "Text";
           rcbPerson.DataValueField = "Value";
           rcbPerson.DataBind();
           e.Message = d.Message;
       }

Is there a better way of doing it?
0
Kalina
Telerik team
answered on 03 Sep 2011, 01:48 PM
Hi Amit,

Let me suggest you take a look at this help article.

Kind regards,
Kalina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Amit
Top achievements
Rank 1
answered on 07 Sep 2011, 10:12 PM
Thanks for your reply Kalina. I don't want to use webservice because after deployment on server it was running too slow. I posted another thread for this problem (http://www.telerik.com/community/forums/aspnet-ajax/combobox/radcombobox-too-slow-when-deployed-to-server.aspx) but no one replied. So I replaced web service with the direct combobox population in code behind.
0
Kalina
Telerik team
answered on 13 Sep 2011, 09:37 AM
Hello Amit,

In general you can continue using the approach you've posted below, or you can simplify your code by implementing a Server-Side Load On Demand - as is demonstrated here.

Best wishes,
Kalina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Amit
Top achievements
Rank 1
Answers by
Amit
Top achievements
Rank 1
Kalina
Telerik team
Share this question
or