We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Refresh data

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?

2 Replies

PE Peter March 30, 2003 04:41 AM UTC

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?

PE Peter March 30, 2003 04:47 AM UTC

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.

Live Chat Icon For mobile
Up arrow icon