Using RadComboBoxData to Populate RadComboBox

5 posts, 0 answers
  1. Amit
    Amit avatar
    6 posts
    Member since:
    Aug 2011

    Posted 30 Aug 2011 Link to this post

    Hi,

    I have a RadComboBoxData object with all the data items. How can use it to populate RadComboBox?
  2. Amit
    Amit avatar
    6 posts
    Member since:
    Aug 2011

    Posted 30 Aug 2011 Link to this post

    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?
  3. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 03 Sep 2011 Link to this post

    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 >>

  4. Amit
    Amit avatar
    6 posts
    Member since:
    Aug 2011

    Posted 07 Sep 2011 Link to this post

    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.
  5. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 13 Sep 2011 Link to this post

    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.
Back to Top