But how does the pagination of data from the Database work in Wisej fo DatagridView Control?

0
0

I have used different controls in several frameworks, but I cannot understand whether it is possible to paginate in a “simple way” a DatagridView Control in Wisej.
I have created examples but they seem to me to be of little use, there are examples of pagination by cells, perhaps a bit too exaggerated.

Usually one retrieves an:
// A control event triggered in the scroll or table move
IEnumerable<MyObject> res = datasourceEntityFramework.GetPage(evt.startIndex, evt.numElementsInPage)

once retrieved, it is assigned back to the datagrid object:
// Data set of the page requested by the component
objDatagrid.DataSource = res

// Number of total records of the datasource to size the scrollbar correctly
objDatagrid.RowCount = datasourceEntityFramework.GetRowCount()

To do this, the control has an event which it invokes when the user moves and which provides the current page and the number of elements currently displayed on the page.

I have tried using VirtualMode to true and using CellValueNeeded but it is unusable on a dataset like list or IEnumerable, I think… it is recommended to look at the DataRead event but I can’t figure out how to reassign the data that I can eventually retrieve.

Can anyone give me some help an advice or an example to follow because there is not much in the documentation the examples are always about retrieving all the data in a table from the database which is then paged by the control but I would like to be able to paginate also server-side on the Database.

Thank you to anyone who wants to help me

  • You must to post comments
0
0

Hi Tiziano,,

There’s many many ways of dealing with Pagination, or caching in this case.
Wisej.NET’s DataGridView is already in full virtual scroll mode,

You can go with the legacy route, and that is basically specifying what page to look for.
Or, you can go with the “Caching approach”.

The client-side can manage its own cache and paging whereas the server side can implement any caching system.

I have attached a sample to showcase this behavior!

For more info, you can check out Microsoft’s documentation about implementing VirtualMode from here: Microsoft | Implementing Virtual Mode in the Windows Forms DataGridView Control

In Wisej.NET, to virtualize the server side you’ll need to use VirtualMode and CellValueNeeded and DataRead event to manage the paginated cache.
You can check out our documentation for that here: Wisej.NET Documentation | DataGridView.DataRead

HTH,
Alaa

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.