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.
Hey,
I have a DataTable with few rows pouplated. On some condition, I want the grid to display only the last few rows of the dataTable and few new rows to be added to the end of the last few rows. How do I bring to effect this modification of the DataTable.
Thanks..
ADAdministrator Syncfusion Team February 10, 2004 02:41 AM UTC
Me again...
Just more insight into the doubt -
>I have a DataTable with few rows pouplated. On some condition, I want the grid to have only the last few rows of the dataTable and few new rows to be added to the end of the last few rows. Meaning the first few rows of the datatable should be cleared. How do I bring to effect this modification of the DataTable.
>
>Thanks..
ADAdministrator Syncfusion Team February 10, 2004 08:15 AM UTC
If you can pick out the rows you want ot see with a RowFilter string, then you can set the DefaultView.RowFilter property on your datatable.
Another way to handle this that does not require being able to write a filter, is to handle teh Model.QueryRowHeight event, and if the e.Index is not one of the rows you want to see, then set its size to 0.
//subscribe to the event
this.gridDataBoundGrid1.Model.QueryRowHeight += new GridRowColSizeEventHandler(grid_QueryRowHeight);
//the handler (showing last 5 rows)
private void grid_QueryRowHeight(object sender, GridRowColSizeEventArgs e)
{
if(e.Index > 0 && e.Index < this.gridDataBoundGrid1.Model.RowCount - 5)
{
e.Size = 0;
e.Handled = true;
}
}