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

In unbound mode, how display value for field with combobox

4 Answers 97 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Waleed
Top achievements
Rank 1
Waleed asked on 11 Dec 2010, 08:44 PM
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

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 14 Dec 2010, 12:42 PM
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
0
Waleed
Top achievements
Rank 1
answered on 14 Dec 2010, 02:58 PM
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
0
Rossen Hristov
Telerik team
answered on 14 Dec 2010, 05:45 PM
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
0
Waleed
Top achievements
Rank 1
answered on 14 Dec 2010, 06:55 PM
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
Tags
DataFilter
Asked by
Waleed
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Waleed
Top achievements
Rank 1
Share this question
or