iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi,
I have a webgrid which is bound from a cutom object. The Grid is bound to a single object of type
public class BindMyData : CollectionBase, IHierarchicalList
{...}
All works fine on paging if the PagingMode="ClassicPaging" is implemented & load on demand i NOT set.
The problem aries is when the attribute PagingLoadMode="Custom" is set. (I need to set this flag due to the very slow load time on initial requests to get ALL the object collection, therebye allowing the collection to be loaded by page each time)
Can you please provide a complete code behind solution for this ?
From the documentation it look as ifthe WebGrid framework expects a ISDataSource to implement a SelectCountMethod="GetCount" and SelectMethod="GetData" in which the following is required.
-> public DataTable GetData(int startRowIndex, int maximumRows, string sortExpression)
How do i get paging forward and backward to initiate a postback so i can handle the event myself ?How do i get the targetted page number ?
Thanks
Pendry
Hello Pendry,
You can see those files in our WebGrid sample>>App_Code>>dsNorthwind_extended.cs.The sample that used that method is ClassicPagingUsingCustomDataRetrieval.aspx.
Let's me explain the behaviour and logic in this code snippet.
1. Here is the first load.
At first, startRowIndex would start from 0 and maximumRows would start from 25.In this case, startRowIndex and maximumRows are handled automatically by WebGrid.In this sample, the paging size is left as default, which is 25. That's why maximumRows is 25.startRowIndex starts from 0, means that WebGrid is still in page 1.You can see the query details in the image.
2. Here is what hapenned if we navigate into the second page.
When you navigate into the second page (or maybe others page), startRowIndex would start from 25.As I said before, WebGrid handled this automatically. The number page increased into 2 which would show the next startRowIndex based on your paging size.
3. If you do sorting during this scenario, you can also see that it will load based on your sortExpression which is also handled by WebGrid automatically.
For your information, all those paging are using ISDataSource.If you don't want to use ISDataSource at all, you can your own query at InitializeDataSource event.E.g in our WebGrid Tutorial>>V 3.5>>CustomVirtualLoad.aspx.It is using VirtualLoad as its paging mode.
Regards,Handy
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname