Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
910
Number of Columns not staying in sync with DataTable.
posted

I have a DataTable that I create on the fly, and orginally I put 10 columns in it and it binds to the datagrid with the DataSource property.

However, the user than has the option to increase or decrese the column, when the user selects to increase the column count greater than the original column count ( like going from 10 to 15), I can create the new DataTable and increase the columns in it, but when I bind the new DataTable to the DataGrid, I only get the first 10 columns.  The grid seems to ignore the other 5 columns.

The data in the first 10 columns is updated to the new DataTables data, but for some reason it wont increase the number of columns past the orginal amount.

My binding is as simple as

this.DataGrid.DataSource = null;

this.DataGrid.DataSource = dataTable.Rows;

Anyone seen this or know how I can resolve this ?

Thanks

DK

Parents Reply Children
No Data