Hello Guys,
Hope you are doing great. Here I have an issue with infragistics grid. On my grid I have several row so I need to scroll down to go to the bottom of the grid. So if I select a row in thr grid and if I update it and if I refresh the grid, its taking me to the top of the page which is very annoying.
So the requirement is it should take me to the row where I was working on.
Can anybody help me with this.
Our APP is WINFORMS AND INFRAGISTICS.
What do you mean by "refresh the grid"? Are you completely rebinding the grid, or doing something that would otherwise cause a Reset notification to be sent to the grid? If this is the case, then the grid regenerates its rows, causing you to lose the scroll position. What you could do is keep track of which row is active, by index, and simply activate the row again, i.e.
int rowIndex = -1;if(grid.ActiveRow != null) rowIndex = grid.ActiveRow.Index;// Refresh gridif(rowIndex > -1) grid.Rows[rowIndex].Activate();
-Matt
Hey Matt,
That logic works for me. But here is another scenario. If I delete a row and rebind the grid then it throws an error saying that the rowindex is out of bound.
I think we have verify before making the row activate whether its actually exists or not.
Can you please help me with this.
This is where I mentioned in my second post that likely the index isn't the best way to do this. You'll have to store some sort of information that can be used to locate the row later, either by looping through the rows in the data source or through the rows in the grid, then activating that row. There really isn't going to be a better way of doing this since there will be new instances of UltraGridRow objects, so you can't store a direct reference to that row before re-binding.