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

ComboBox Column from DataTable

3 Answers 94 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Orit
Top achievements
Rank 1
Orit asked on 18 Jun 2009, 11:21 AM
Hi
 I want to bind values to my 

GridViewComboBoxColumn

from a DataTable
and I "fly"

this is my code
<telerik:RadGridView.Columns> 
                <telerik:GridViewComboBoxColumn     
                                    DataMemberBinding="{Binding Path=UnitName}"      
                                    DisplayMemberPath="Name"     
                                    SelectedValueMemberPath="ID"     
                                    HeaderText="שם היחידה"     
                                    UniqueName="UnitName" Width="120" /> 
                  
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView> 

DataTable dt = new DataTable();  
dt.Columns.Add("UnitName",typeof(int));  
dt.Rows.Add(1);  
dt.Rows.Add(2);  
((GridViewComboBoxColumn)this.gvLoadingCustomers.Columns["UnitName"]).ItemsSource = GetUnits();                  
gvLoadingCustomers.ItemsSource = dt.DefaultView;  
            

private DataView GetUnits()  
        {  
            DataTable dt = new DataTable();  
            dt.Columns.Add("Id", typeof(int));  
            dt.Columns.Add("Name", typeof(string));  
            dt.Rows.Add(1,"חטיבה בנקאית");  
            dt.Rows.Add(2,"חטיבה מסחרית");  
            dt.Rows.Add(3,"חטיבה עסקית");  
            dt.Rows.Add(4,"GPB");  
            dt.Rows.Add(5,"מת''מ");  
            return dt.DefaultView;  
        }  
 

when I bind the data to the Combo from a 

System.Collections.

IEnumerable

 

it works, but when I use a dataTable it fail...

Thanks

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 18 Jun 2009, 01:02 PM
Hello Orit,

Currently, the GridViewComboBoxColumn cannot pull data correctly from a DataTable. I have logged this issue and our developers will try to implement this feature in time for tomorrow's internal build. Until this feature is available, the only workaround is to use a collection of business objects as the combo's ItemsSource.

Please, excuse us for the inconvenience.

Best wishes,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rossen Hristov
Telerik team
answered on 19 Jun 2009, 07:10 AM
Hello Orit,

By the way, I have noticed that the column name you specify is "Id" and then you specify a SelectedValueMemberPath as "ID".

Can you try with the same string at both places and see whether it will work as expected?

All the best,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Rossen Hristov
Telerik team
answered on 19 Jun 2009, 08:48 AM
Hello Orit,

I have just talked to our developers and they assured me that the DataTable issue will be resolved for the upcoming 2009 Q2 release which is only a few weeks away. Please, excuse us for the inconvenience.

Best wishes,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Orit
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or