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

DataTypeConverter for DropDownList

0 Answers 129 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Timotei
Top achievements
Rank 1
Timotei asked on 22 Jun 2017, 02:59 PM

Hi!

Is there a way, maybe I'm missing something, to apply a DataTypeConverer to a DropDownList, the same as we are able to do with a column in a RadGridView?

The idea is that the DisplayMember I need to set is a collection of KeyValuePair. Depending on a key configured externally, I need to choose a specific value. This can be done for grid by applying a custom DataTypeConverter.

For example, let's say the data source is like the following:

var dataSource = new List<Entity>{
        new Entity
{
            int Id = 1;
            string Name = "NameSample";
            Dictionary<int, string> Descriptions = new Dictionary<int, string>
            {
                {0, "descriptionInEnglish"},
                {1, "descriptionInGerman"}
            };
        }

};

I need to set the DisplayMember of the DropDownList to show the description in a language depending on an external setting.

 

Thanks!

No answers yet. Maybe you can help?

Tags
DropDownList
Asked by
Timotei
Top achievements
Rank 1
Share this question
or