WebGrid enables user to apply custom Load-On-Demand paging.
In this topic, you will learn how to implement custom Load-On-Demand Paging.
To implement custom Load-On-Demand Paging
- Bind WebGrid to ISDataSource (Using Customers table).
- Open WebGrid Designer. Click See all Properties
and set PagingMode to VirtualLoad, VirtualLoadMode
to Custom.
- Open ISDataSource Designer. Go to Tables and select Customers.
- Set EnablePaging to True, MaximumRowsParameterName
to maximumRows, SelectCountMethod to SelectCount
and StartRowIndexParameterName to startRowIndex.
- You need to prepare two method with the correct parameter in DAL :
- Select Method with 3 parameters : startRowIndex, maximumRows, and sortExpression.
e.g : public DataTable GetData(int startRowIndex, int maximumRows, string sortExpression)
- SelectCount Method with 1 parameter : sortExpression
e.g : public int SelectCount(string sortExpression)