In unbound mode, how display value for field with combobox

5 posts, 0 answers
  1. Waleed
    Waleed avatar
    3 posts
    Member since:
    Dec 2010

    Posted 11 Dec 2010 Link to this post

    Hi. I'm using the RadDataFilter in unbound mode. Some of the fields have custom editor, using combobox.
    My question is: how can I display a default value for such fields?
    Specifically, when I do the following it doesn't work:

    //The following two lines are inside radDataFilter_EditorCreated event handler
    ((ComboBox)e.Editor).ItemsSource = Cultures.Select(c => c.CultureName).ToList();
    ((
    ComboBox)e.Editor).SelectedIndex = 0; //This does not select the first item in the combo

    Any input in this regard is highly appreciated.

    Thank you,

    Waleed
  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 14 Dec 2010 Link to this post

    Hello Waleed,

    1. What is this Cultures object? We have never seen it before. Does it return anything at all?
    2. The control ComboBox is a control offered by Microsoft. We can't be responsible for a third-party control. Maybe you should ask MS why their combo is not selecting its first item.

    I hope this helps.

    Best wishes,
    Ross
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  3. DevCraft banner
  4. Waleed
    Waleed avatar
    3 posts
    Member since:
    Dec 2010

    Posted 14 Dec 2010 Link to this post

    Hi Ross,

    Thank you very much for your reply.
    Cultures is just a list which includes a group of objects.

    So, does your reply mean that my code is correct and should work?

    On the other hand, is it possible to use Telerik Silverlight Combobox instead of MS combobox? How can I do this in the case of RadDataFilter values?

    Thank you,

    Waleed
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 14 Dec 2010 Link to this post

    Hi Waleed,

    The MS ComboBox and RadComboBox are interchangeable. So you can use either one. It really does not matter that much.

    Anyway, the question now is: If you take these two lines of code and execute them the outside RadDataFilter, i.e. in a simple SL page that has nothing but a ComboBox, does it work? This is very important.

    Just create a new page, add a combo in the page and do the same thing.

    What do you get. Is it working?

    Kind regards,
    Ross
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  6. Waleed
    Waleed avatar
    3 posts
    Member since:
    Dec 2010

    Posted 14 Dec 2010 Link to this post

    Hi Ross,

    I created a simple SL page and tried the following two lines:

    culturesCombobox.ItemsSource = Cultures.Select(c => c.CultureName).ToList();
    culturesCombobox.SelectedIndex = 0;

    They worked correctly and the first item in the combobox was selected.

    Thank you,

    Waleed
Back to Top
DevCraft banner