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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataTable modification doubt

Thread ID:

Created:

Updated:

Platform:

Replies:

10681 Feb 10,2004 02:36 AM UTC Feb 10,2004 08:15 AM UTC WinForms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 10, 2004 02:36 AM UTC

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..

Administrator [Syncfusion]
Replied On 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..

Administrator [Syncfusion]
Replied On 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; } }

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;