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

GridView columns not updating as DataTable columns update

1 Answer 281 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 19 Apr 2013, 12:00 AM
I have a RadGridView which has its ItemsSource property bound to the the DefaultView of a DataTable that is created and updated by a ViewModel.  The GridView has the AutoGenerateColumns property set to true.

When columns are added to this DataTable and the PropertyChanged event is fired, the new columns are not added to the GridView.

Also, when columns are removed from the DataTable and the PropertyChanged event is fired, the data from these columns is removed from the GridView, but not the columns themselves.

Does the AutoGenerateColumns property only generate columns when the control is initialized?  Does this behavior of dynamically removing and adding columns as the underlying DataTable is changed not exist?

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 19 Apr 2013, 11:05 AM
Hello,

In short - YES , columns are auto generated initially  and later changes in the columns of source table should be handled by custom code. There is no functionality built in RadGridView to keep watch on changes in columns in a data table.

Regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or