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

Selections Moving Themselves :S

Hello. I have 2 tabs and a single GDBG. The datasource is a dataview. On Tab Change, the row filter on the dataview changes. I am using Grid Hierarchy also. The problem is that when the tab is changed, Selections of the grid moves someplace else. For example, if third row from top is selected( which could be at level index 1 or 0) when the filter changes, the selections sometimes moves to some other row otherwise remains at the same place .... The only thing im doing on tab change is resetting the filter. Please reply asap ... thx!!

10 Replies

M. M.F.K. July 8, 2004 01:18 AM

Attaching sample. >Hello. I have 2 tabs and a single GDBG. The datasource is a dataview. On Tab Change, the row filter on the dataview changes. I am using Grid Hierarchy also. The problem is that when the tab is changed, Selections of the grid moves someplace else. For example, if third row from top is selected( which could be at level index 1 or 0) when the filter changes, the selections sometimes moves to some other row otherwise remains at the same place .... The only thing im doing on tab change is resetting the filter. > >Please reply asap ... thx!! SelectionsApp_6857.zip


AD Administrator Syncfusion Team July 8, 2004 02:21 AM

I cannot run your sample as is because of missing code for Syncfusion.Windows.Forms.Grid.ExtendedDataBoundGrid. When you change tabs, do you change the CurrencyManager.Position of the currency manager for the grid''s DataSource. If so, since you are using ListBoxSelectionMode on the grid, this will change the position of the current row in the grid, and hence will change the selection. If this is the case, you could save this position before chnging it, and the restore it before showing the tab again in the SelectedIndexChanged event.


M. M.F.K. July 8, 2004 02:37 AM

I HAVE ATTACHED THE EXTENDED DLL ... Sorry for mistake ... Waiting for Reply >I cannot run your sample as is because of missing code for Syncfusion.Windows.Forms.Grid.ExtendedDataBoundGrid. > >When you change tabs, do you change the CurrencyManager.Position of the currency manager for the grid''s DataSource. If so, since you are using ListBoxSelectionMode on the grid, this will change the position of the current row in the grid, and hence will change the selection. If this is the case, you could save this position before chnging it, and the restore it before showing the tab again in the SelectedIndexChanged event. ExtendedDataBoundGrid_7489.zip


AD Administrator Syncfusion Team July 8, 2004 03:07 AM

You are trying to show the same grid with different DataViews on two different tabs. As I suggested above, the grid will not retain its current position as you filter DataViews. You will have to do something yourself, either saving the position on a tab by tab basis (or DataView by DataView basis) and then restoring them when the object is used again. Or, a simpler thing might be just to reset the position to zero at the bottom of your SelectedIndexChanged event handler. this.edbgMain.Binder.CurrentPosition = 0; this.edbgMain.EndUpdate();


M. M.F.K. July 9, 2004 03:32 AM

I have tried to save the values on tab by tab basis ... I have succeeded in saving the selected rows before tab changes and setting them again when the tab is reselected ... However now I cannot control the scrollbar. It just moves as it likes. I want the the selections to be scrolled to view ... I have tried using Scrolling Methods to no use .... I would appreciate it if you make the changes in the sample for me ... Thx! >You are trying to show the same grid with different DataViews on two different tabs. As I suggested above, the grid will not retain its current position as you filter DataViews. You will have to do something yourself, either saving the position on a tab by tab basis (or DataView by DataView basis) and then restoring them when the object is used again. > >Or, a simpler thing might be just to reset the position to zero at the bottom of your SelectedIndexChanged event handler. > > >this.edbgMain.Binder.CurrentPosition = 0; >this.edbgMain.EndUpdate(); >


AD Administrator Syncfusion Team July 9, 2004 03:38 AM

Try saving and then resetting the grid.TopLeftRow property as you switch tabs. This should get the top row set.


M. M.F.K. July 9, 2004 05:01 AM

That didnt seem to work either .... I am really stumped :S >Try saving and then resetting the grid.TopLeftRow property as you switch tabs. This should get the top row set.


AD Administrator Syncfusion Team July 9, 2004 05:03 AM

Can you post a sample project showing the problem you are having?


M. M.F.K. July 9, 2004 05:11 AM

Its the same project using the toprow. Attaching extended dll separate >Can you post a sample project showing the problem you are having? ExtendedDataBoundGrid_520.zip SelectionsApp_274.zip


AD Administrator Syncfusion Team July 9, 2004 05:36 AM

Setting the TopRowIndex seems to home the scrollbars for me in your sample. Here is the code I used. I modified the code that was setting the Position to zero as the previous code seemed to not set the focus to the grid in some cases, but that did not affect the scrollbar for me.
BindingManagerBase bmb = this.BindingContext[this.edbgMain.DataSource, this.edbgMain.DataMember];
bmb.Position = 0;
this.edbgMain.TopRowIndex = this.edbgMain.Model.Rows.HeaderCount + 1;
this.edbgMain.EndUpdate();
this.edbgMain.CellClick += new GridCellClickEventHandler(edbgMain_CellClick);
What steps do I take to see the problem in the sample?

Loader.
Live Chat Icon For mobile
Up arrow icon