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

Grid Selection, Changes when refresh data

Hai, I am using DataBoundGrid, and the contents gets refreshed each time I press a refresh button. But the problem is, when I refresh the contents of the grid, the selection goes to the row just above the current selection. ( Selection shifts one row up each time I refresh the contents). The grid is wired with Filter bar. I update the filterbar, each time I refresh data. Is there any specific reason for this. Is there any means by which I can avoid the same.. THanks in advance, Bidin

3 Replies

AD Administrator Syncfusion Team March 9, 2004 11:20 PM UTC

How are you refreshing the contents of the grid? Are you doing a DataSet.Merge, or changing values directly in the grid using an indexer on the grid, or changing values directly in your datatable, or set a new datasource to the grid, or something else?. Can you post a little sample showing the problem? If not, can you post your code that you use to refresh the contents?


BD Bidin Dinesababu March 10, 2004 04:43 PM UTC

Here is the sample which I use to refresh the grid data within a class derived from DataBoundGrid. _dataSet is a member variable. Which gets merged with the new data. DataSet ds = _dataSet.Clone(); ds.ReadXml(new System.IO.StringReader((xmlData))); _dataSet.Merge(ds, false, MissingSchemaAction.AddWithKey); this.BeginUpdate(); this.FreezePainting = true; this.DataSource = _dataSet.Tables["M"]; this.BringToFront(); this.FreezePainting = false; this.EndUpdate();


AD Administrator Syncfusion Team March 10, 2004 05:01 PM UTC

I don''t really understand how the grid would play a role on how the data is merged into this data set. If you use the same code to update a Windows Forms DataGrid, does the data get positioned properly there? You mentioned a FilterBar in your first post. You might consider unwiring and re-wiring the filterbar (while freezePainting is true) to see if that affects anything? Is there an active filter when this code is being hit?

Loader.
Live Chat Icon For mobile
Up arrow icon