Posted: 29 May 2018 12:00 EDT Last activity: 29 May 2018 14:45 EDT
How to Restrict the number of visible rows/records in DataGridView Control
I am using DataGridView Control to display the records on Windows Form. Currently the source is Table View, which gets the data from ODBC query.
Now, I want to restrict the number of records shown on UI to certain number. For Example, if the Table view is having 100 records, I just want to show to 25 only.
Is there any view achieve it using the properties/methods present in DataGridView Control?
I don't want to reduce the number of records in TableView. I want to restrict the visibility in UI only.
I already achieved my requirement using any other way (copying the required number of records from TableView to LookupTable and then giving the LookupTable data as source to this DataGridView Component, but want to know the best way of controlling the row count in Data Grid itself.
This is more of a .Net question than one for Pega Robotics as the DataGridView control is not provided by Pega. You might find more detailed information searching it on CodeProject or a similar site.
If I had this requirement, and there were no properties that I could see, then I would probably do the following; create a script where I grabbed the DataTable from the TableView and then copy the first 100 rows into a new DataTable and output that and bind it to the DGV. If you wanted to do this in an automation, you could iterate the TV rows, and then add each of the first 100 into a LookupTable and bind the LookupTable to the DGV.