Fill ComboBox from WebService

4 posts, 1 answers
  1. Meerkat
    Meerkat avatar
    64 posts
    Member since:
    Feb 2007

    Posted 17 Jul 2008 Link to this post

    Your example hand codes the data into a class which is used to fill your new combobox. I would like to do something of more practical use by filling the combobox using a webservice. It would be really great if you could tell me how this might be done. A working example would be brilliant but I realise that might be asking a bit much. If the following is too unclear to follow, any help on how to use a combox to display data returned from s web service would be very much appreciated.


        public List<view_County> GetCounties()
          DataClassesDataContext db = new DataClassesDataContext();
          var query = from d in db.view_Counties
                      select d;
          return query.ToList();

    (view_Counties returns a single field called County;)


    <UserControl x:Class="TestTelerik.Page"
        Width="400" Height="300">

        <StackPanel x:Name="LayoutRoot">
          <telerik:RadComboBox x:Name="RadComboBox1" />


     void client_GetCountiesCompleted(object sender, GetCountiesCompletedEventArgs e)
    // These two lines do not display anything at all, so what do I need to do please.

          RadComboBox3.DataContext = e.Result;
          RadComboBox3.DisplayMemberPath = "County";

    Many thanks,


  2. Answer
    Valeri Hristov
    Valeri Hristov avatar
    2252 posts

    Posted 17 Jul 2008 Link to this post

    Hello Pete,

    On a first glance I could suggest trying one those two variants (I think that both of them should work):

    1) Keep the existing C# and XAML and add ItemsSource={Binding} in RadComboBox tag:
    <telerik:RadComboBox x:Name="RadComboBox1" ItemsSource={Binding} />

    2) Instead of setting DataContext=e.Result in the C# client code, set ItemsSource
    RadComboBox3.ItemsSource = e.Result;

    Let me know if those do not work for you and I will prepare a working example.

    Valeri Hristov (Silverlight Team)
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Meerkat
    Meerkat avatar
    64 posts
    Member since:
    Feb 2007

    Posted 17 Jul 2008 Link to this post

    Hi Valeri,

    Both your solutions worked perfectly!
    Thank you very much for your prompt and helpful reply,



  4. Matthew
    Matthew avatar
    46 posts
    Member since:
    Aug 2011

    Posted 20 Oct 2011 Link to this post

    I have tried the suggestions listed above, but I am getting the following result.

    There are 4 items being returned and bound to the control, but the Display and Value Member Paths are all null...?

    If I do not provide Display and Value Member Paths then it displays 4 items in the dropdown as "Namespace.Class".
Back to Top