The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi,
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
//GridDataBoundGrid dgrQueryResults
private void dgrQueryResults_TopRowChanging(object sender, GridRowColIndexChangingEventArgs e)
{
if(bAllowRaiseEvent)
{
//e.Cancel=true;
int pos = e.Value;
MessageBox.Show("Value "+pos);
CurrentPostScroll = pos;
//Get next row to jump.
CurrentPostScroll = GetNearlyPosition(pos);
this.dgrQueryResults.TopRowIndex=CurrentPostScroll-1;
this.dgrQueryResults.SetTopRow(CurrentPostScroll-1);
this.dgrQueryResults.InternalSetTopRow(CurrentPostScroll-1);
this.dgrQueryResults.VScrollBar.Value=CurrentPostScroll-1;
this.dgrQueryResults.VScrollBar.Maximum = Math.Max(CurrentPostScroll-1, this.dgrQueryResults.VScrollBar.Maximum);
this.dgrQueryResults.UpdateScrollBars();
this.dgrQueryResults.Invalidate();
//CurrentCell.MoveTo(pos-1,0);
}
}
Please help me,
Thanks,
ADAdministrator Syncfusion Team May 11, 2005 10:42 PM UTC
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 06:57 AM UTC
Thank you,
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.
Thanks,
ADAdministrator Syncfusion Team May 13, 2005 01:05 PM UTC
You can avoid executing the code more than once by setting a flag.