Sometimes I have to replace the data in the grid with other data (eg. the user changes the language in which he wanna see the data). So I clear the datatable and dispose the dataadapter. Then I create a new dataadapter and fill the datatable. After that I set the DataSource of the grid to the DataTable. Although there are rows in the DataTable the Grid doesn't show them. Is there a better way to replace the data in the grid or why the described behaviour occurs?
In additition to this I wanna refresh the data in da DataBoundGrid every time a user selects another row. In the RowEnter event I do a DataTable.Clear and then a fill from the dataadapter. After that I set the DataSource of the Grid again to the DataTable. All works fine if the default sorting is used. If the user resorts the Grid by clicking at the column header it works all too but there is a flickering in the Grid where you can see that all cells are removed and then refilled. I thought of preventing this by add a "BeginUpdate" and "EndUpdate" around the code but that doesn't help. What am I doing wrong?
PEPeterMarch 29, 2003 11:47 PM
Well if you write the problems down and think about them a while you solve them at your own :-) I found out that all problems are solved with putting a "GridDataBoundGrid.Binder.SuspendBinding" and "GridDataBoundGrid.Binder.ResumeBinding" around.