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

[Solved] Binding Hashtable to colums

7 Answers 136 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Forest
Top achievements
Rank 1
Forest asked on 19 Oct 2010, 06:35 PM
Hi

I have a Hashtable. It represent a word translation.

The Key is the country and the value is the translated word.

MyHashtable.Add("EN","Day") ;
MyHashtable.Add("DL","Tag") ;
MyHashtable.Add("FR","Jour") ;

How can i create dynamically 3 Colums for each value ? The header of the colum may be the Key.

There is maybe another way to resolve my data construction.

Thank you

7 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 Oct 2010, 03:13 PM
Hello,

 Can you post a bit more info about your scenario? If you want to localize the grid please check this demo for more info.

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Forest
Top achievements
Rank 1
answered on 21 Oct 2010, 03:29 PM
Hello

I will not use Hashtable. I will use Dictionary.
My probleme looks like this : http://www.telerik.com/community/forums/silverlight/gridview/binding-to-a-dictionary.aspx

My problem is less difficult : i had to use Dictionary<string, string> and not Dictionary<string, object>
Do I had to use DictionaryConverter in my case ?
I'm trying to adapt your example 
Thank you

Mathieu
0
Vlad
Telerik team
answered on 21 Oct 2010, 03:38 PM
Hello,

 If you want dynamic data binding in Silverlight it will be better to try our lightweight DataTable.

All the best,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Forest
Top achievements
Rank 1
answered on 22 Oct 2010, 05:11 PM
Hi

I succeded in displaying my data.
I have used the bindingtodictionary.zip technics.

But i can't modify these data into my gridView.

Here is my colums creation :

                    foreach (string languageKey in currentDataContext.LanguageList)
                    {
                        dataColumn = new GridViewDataColumn() { Header = languageKey, DisplayIndex = columIndex, UniqueName = languageKey };

                        binding = new Binding();
                        binding.Path = new PropertyPath("TranslationList");
                        binding.Mode = BindingMode.TwoWay;
                        binding.Converter = new DictionaryConverter(languageKey);

                        dataColumn.DataMemberBinding = binding;

                        grid.Columns.Add(dataColumn);

                        columIndex++;
                    }

Can you help me please ?
Or can you simply modify the bindingtodictionary.zip .

Thank you

Mathieu
0
Forest
Top achievements
Rank 1
answered on 28 Oct 2010, 02:00 PM
Hello

It's is possible to have the bindingtodictionary.zip example in which i could modify values ?

Thank you

Mathieu
0
Vlad
Telerik team
answered on 28 Oct 2010, 02:09 PM
Hi,

 I still believe that you should use our lightweight DataTable instead plain dictionary. Have you tried the DataTable?

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Forest
Top achievements
Rank 1
answered on 28 Oct 2010, 02:14 PM
Hi

I have to create dynamicaly some of my colums but not all colums.

It's it possible with DataTable?

Mathieu
Tags
GridView
Asked by
Forest
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Forest
Top achievements
Rank 1
Share this question
or