Add/Remove column in DataTable not propagated to RadGridView

1 posts, 0 answers
  1. New
    New avatar
    8 posts
    Member since:
    Nov 2012

    Posted 18 Jan 2013 Link to this post

    I am using version 2012.1.326.35.

    I have a RadGridView with a DataTable dt as ItemsSource. The RadGridView appears to render the initial column specification correctly and also recognize the row changes. However, when I update the columns, then I notice that addition and removal of columns are not recognized in the RadGridView.

    This is how I refresh my DataTable:

    public void updateData(SomeCustomDataSource data)
    int num_cols = model.Columns.Length;
    for (int i = 0; i < num_cols; i++)
    SomeCustomColumn c = data.Columns[i];
    if (!dt.Columns.Contains(.Name)) // Adding columns not previously existing
    DataColumn col = CreateDataColumn(c);
    RefreshGrid(); // Plain old OnPropertyChanged("DataSource");
    I'd like to note that this is just some dummy code. In the actual code I wanted to use, I called dt.Columns.Clear() and re-added every single column on data update. And what happens in that case is that none of the columns changed but when I click on the "click to add new row" row insertion thing, I get a "[Column] does not belong to Table [Table]" ArgumentException, which implies the internal data is not actually refreshed in the RadGridView even though the rows are updated correctly.

    Again, if you want my license key in order to provide support, I'd be happy to provide it.
Back to Top