N
newsgroper
I extended a windows datagrid to some formatting and to add controls
like buttons and comboboxes. To get the datagrid to accept the
changes I add tablestyles. To make the datagrid use the new
tablestyles and bind to the table I used the following code...
this.TableStyles.Clear();
this.TableStyles.Add(_tableStyle);
this.DataSource = ((DataSet)this.DataSource).Tables[tableName];
Everything works great! However, now my form needs to access the
grids datasource as a dataset like so...
theDataSet.Update((DataSet)theGrid.DataSource);
Unfortunately, I get an invalid cast exception since the datasource is
a datatable. Can anyone give me suggestions so I can update the
dataset that was originally bound to my grid? I know the problem is
because I bound the table to the grid (within the grid's code) when I
extended the grid. I am just not sure how to get the datasource back
to a dataset.
like buttons and comboboxes. To get the datagrid to accept the
changes I add tablestyles. To make the datagrid use the new
tablestyles and bind to the table I used the following code...
this.TableStyles.Clear();
this.TableStyles.Add(_tableStyle);
this.DataSource = ((DataSet)this.DataSource).Tables[tableName];
Everything works great! However, now my form needs to access the
grids datasource as a dataset like so...
theDataSet.Update((DataSet)theGrid.DataSource);
Unfortunately, I get an invalid cast exception since the datasource is
a datatable. Can anyone give me suggestions so I can update the
dataset that was originally bound to my grid? I know the problem is
because I bound the table to the grid (within the grid's code) when I
extended the grid. I am just not sure how to get the datasource back
to a dataset.