I have an issue, Please let me know how to resolve it.
I must paging my DataGrid into many pages, I using TopRowChanging event to jump to the next page. I using SetTopRow to changes the top row index and scrolls the grid. But I seem it doesn''t jump to the row I need.
Below is my code
private void dgrQueryResults_TopRowChanging(object sender, GridRowColIndexChangingEventArgs e)
int pos = e.Value;
CurrentPostScroll = pos;
//Get next row to jump.
CurrentPostScroll = GetNearlyPosition(pos);
this.dgrQueryResults.VScrollBar.Maximum = Math.Max(CurrentPostScroll-1, this.dgrQueryResults.VScrollBar.Maximum);
Please help me,
ADAdministrator Syncfusion Team May 11, 2005 05:42 PM
I do not understand what you are trying to do.
If you want to scroll the grid so rowindex 342 is at the top of the grid, then set grid.TopRowIndex = 342.
The real question how does your user indicate he wants to page the grid? Does he click a button or something? If so, then in your button handler, increment or decrement grid.TopRowIndex by the ''number of rows in your page''.
I do not think you what to try to call SetTopRow in the middle of TopRowChanging.
HDHoang DinhMay 13, 2005 01:57 AM
But When I set TopRowIndex value in TopRowChanged event, this event is raised again.
When I drag or click on the arrow on the scrollbar, I need jump to the next page, so that I must call SetTopRow function to jump to the new page. The grid raise TopRowChanged event at least two times.
How to prevent the TopRowChanged event when I call SetTopRow function.
ADAdministrator Syncfusion Team May 13, 2005 08:05 AM
You can avoid executing the code more than once by setting a flag.