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

Deleting column from WPF datagrid associated with dataset

2 Answers 80 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jorge Gonzalez
Top achievements
Rank 1
Jorge Gonzalez asked on 08 Dec 2009, 05:06 PM
When I update a field in a WPF datagrid that's associated with a dataset the corresponding field in the underlying datatable is also modified after I issue a commitedit.
When I delete a column in the grid the corresponding column in the datatable is still present. Am I responsible for deleting the datatable column or am I doing something wrong?

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 09 Dec 2009, 06:38 AM
Hi,

 Can you post more info how you delete columns in the grid? In don't have any API related to this and most probably you will need to update the DataTable manually.


Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Jorge Gonzalez
Top achievements
Rank 1
answered on 09 Dec 2009, 03:03 PM
Hello Vlad,
     The datatable is kept in synch with the grid when data changes are made to the grid and when rows are added or deleted from the grid but not when columns are deleted. 

Here's the code I use to delete columns:

grid_name.Columns.RemoveAt(<position of the selected column to delete>);

Here's the code I use to remove the column from the datatable:

datatable_name.Columns.Remove(datatable_name.Columns[<position of the selected column to delete>]);

Thanks for your help
Tags
GridView
Asked by
Jorge Gonzalez
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Jorge Gonzalez
Top achievements
Rank 1
Share this question
or