Welcome to the FoxLearn
Today we will learn how to implement custom paging in DataGridView
First, You need to add a DataGridView, a Label and two Buttons to Form1
You can click next button and previous button for load the next and previous data sets respectively
You need to install PagedList
To install PagedList, right click on your project and select Manage NuGet Packages
Search PagedList and click install
PagedList makes it easier for .Net developers to write paging code
It allows you to take any IEnumerable and by specifying the page size and desired page index, select only a subset of that list
PagedList also provides properties that are useful when building UI paging controls
We will use Entity Framework to get data from SQL Server
Entity Framework is an object-relational mapper that enables .NET developers to work with relational data using domain-specific objects
It eliminates the need for most of the data-access code that developers usually need to write
We will use the customer table in Northwind database to play demo
You can download the Northwind database below this video
Now, We will make an asynchronous method to get data from database
The async modifier indicates that the method, lambda expression, or anonymous method that it modifies is asynchronous
An async method provides a convenient way to do potentially long-running work without blocking the caller's thread
The caller of an async method can resume its work without waiting for the async method to finish
The method runs synchronously until it reaches its first await expression, at which point the method is suspended until the awaited task is complete
If a method that's modified by an async keyword doesn't contain an await expression or statement, the method executes synchronously
A compiler warning alerts you to any async methods that don't contain await because that situation might indicate an error
Thank you for watching this video