Home Forums WPF controls Xceed DataGrid for WPF How to update underlying Database from DataTable/Set

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #23603 |

    I was able to follow the docs and create a DataTable DefaultView , use that in creating a datagridcollectionview source, and if i add items to the table they are shown in the grid. I just have some questions from here

    1) there is an insertion row, and i can edit existing items, but i don’t see a default ‘delete’ command, if i highlight a row (vis athe left margin) and hit delete nothing happens, where can i add this functionality?

    2) How do i actually call the update methods on the datatable/view to update the underlying database?

    This is in C#, VS2005 (or Orcas) as i’m testing in both.


    Imported from legacy forums. Posted by rwo123gr (had 2430 views)

    User (Old forums)
    Post count: 23064

    Sample Code:

    namespace WPL.UI.LocationUI
    /// <summary>
    /// Interaction logic for LocationEditor.xaml
    /// </summary>
    public partial class LocationEditor : System.Windows.Controls.Page
    private BindingSource bindingSource;
    private WPL_SDFDataSet dataSet = new WPL_SDFDataSet();
    private WPL_SDFDataSetTableAdapters.LocationsTableAdapter lta = new LocationsTableAdapter();

    public LocationEditor()

    this.dataSet = new WPL_SDFDataSet();
    this.bindingSource = new BindingSource();

    this.dataSet.DataSetName = “locationDataSet”;

    this.bindingSource.DataMember = “Locations”;
    this.bindingSource.DataSource = this.dataSet;


    this.LocationDataGridControl.ReadOnly = false;
    this.LocationDataGridControl.ValidationMode = ValidationMode.RowEndingEdit;
    this.LocationDataGridControl.AutoCreateColumns = true;

    //DataGridCollectionView dataGridCollectionView = new DataGridCollectionView(dv);

    this.LocationDataGridControl.DataContext = this.bindingSource;
    this.LocationDataGridControl.ItemsSource = this.bindingSource;

    this.LocationDataGridControl.Columns[“LocationID”].Visible = false;
    this.LocationDataGridControl.Columns[“Name”].Title = “Location Name”;


    Imported from legacy forums. Posted by rwo123gr (had 275 views)

    Xceed Support
    Post count: 5658

    1) There is no delete functions packaged in the DataGridControl. We wanted to let the user determine their own logic for deletion… Using the “search” link on the top of the page, you can find several examples on how to achieve this feature.

    2) Update to the Database need to be done according to your application’s logic, at your convenience… You can refer to the ADO.NET documentation for details on how to update the database once the dataset was modified.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 3418 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.