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 am new to WebGrid development and I have been assigned a project that like all IT projects must be completed 2 weeks ago. I need to implement custom paging and I was wondering if anyone had any pointers. I've looked at the docs and tutorials and I'm not 100% sure how to handle it.
We have a framework that has the following API call:
int customerId = 67; //This would be specified by a param in the query string of a Url. int pageIndex = 3; int pageSize = 25; Users selectedUsers = Users.GetUsers(customerId, pageIndex, pageSize); int maxPageIndex = selectedUsers.MaxPageIndex; //This is the maximum page index that should be shown on the grid
This returns all users for a given customer, page index and page size. In the same call it also returns the maximum no of pages.This is an n-tiered and layers solution and the GetUsers call makes a special WCF service call to a remote workflow engine. This WCF Workflow Engine can be located anywhere in the world. The only data we have is the Users class as shown above.I have read articles about using a the ISDataSource control and creating a data adapter...but all these examples assume 3 things, 1) You're connecting to a Db and returning datatables and 2) The Db is located either on the server itself, or in the local environment (I base this on the fact there are two seperate methods that need to be implmented, a select data method and a get count) and 3) The get calls have no input params and cannot be filtered by customerId as in my above code.
Ideally what I am looking for is something like the following code snippet. I know this code doesn't exist....but this is the kind of functionality I am looking for:
WebGrid1.PagingEnabled = true; WebGrid1.PagingMode = PagingMode.Classic; Users selectedUsers = Users.GetUsers(this._customerId, 1, 25); WebGrid1.DataSource = selectedUsers; WebGrid1.MaxPageIndex = selectedUsers.MaxPageIndex; private void WebGrid1_PageIndexSelected(object sender, PageIndexSelectedArgs args) { Users selectedUsers = Users.GetUsers(this._customerId, args.SelectedPageIndex, 25); Webgrid1.DataSource = selectedUsers; WebGrid1.MaxPageIndex = selectedUsers.MaxPageIndex; WebGrid1.SelectedPageIndex = args.SelectedPageIndex; }
In theory this should be VERY easy to implement....but I can find any examples of how to do this.Can anyone help me out?
cheers,
Steve
Hello,
Please forgive me for lack of understanding about the reported problem.
Intersoft have WebGrid sample that maybe similar with your current scenario, WebGrid client binding with pagination.
If you don’t mind, please kindly have review in the ClientBinding_Paging.aspx WebGrid samples and let us know your response.(start > All Programs > Intersoft WebUI Studio 2012 R2 > WebUI Studio for ASP.NET > WebGrid 8 > C# Samples.The physical location of the file is: "%ProgramFiles%\Intersoft Solutions\Intersoft WebUI Studio 2012 R2\Samples\For ASP.NET\ISNet.WebUI.Samples\cs\WebGrid\ClientBinding_Paging.aspx".)
Regards,Hans.
I have this almost working now.
Page Source Source:
<ISWebGrid:WebGrid ID="WebGrid2" runat="server" Height="250px" UseDefaultStyle="True" Width="500px" DataSourceID="ISDataSource1"> <LayoutSettings PagingLoadMode="Custom" PagingMode="ClassicPaging" PagingStyleUI="Slider" PagingDataRetrievalMode="ReturnPartialRows" PagingSize="20"> </LayoutSettings> <RootTable> <Columns> <ISWebGrid:WebGridColumn Name="CustomerId" Caption="Customer Id" DataMember="CustomerId" /> <ISWebGrid:WebGridColumn Name="DisplayName" Caption="Display Name" DataMember="DisplayName" Width="200"/> </Columns> </RootTable> </ISWebGrid:WebGrid> <ISDataSource:ISDataSource ID="ISDataSource1" runat="server" SchemaType="CustomObject" LoadOnDemand="true"> <Tables> <ISDataSource:ISDataSourceTable SelectMethod="GetData" SelectCountMethod="SelectCount" TableName="Customers" EnablePaging="true" TypeName="WebGridPaging.CustomersISDataAdapter" > </ISDataSource:ISDataSourceTable> </Tables> </ISDataSource:ISDataSource>
ISData Adapter Code:
public class CustomersISDataAdapter { public CustomersISDataAdapter() { } private Customers _lastCustomers = null; public CustomersISDataCollection GetData(string sortExpression, int maximumRows, int startRowIndex) { Customers items = Customers.GetCustomers(startRowIndex, maximumRows); this._lastCustomers = items; CustomersISDataCollection dataCollection = CustomersISDataCollection.CreateISDataCollection(items); return dataCollection; } public int SelectCount(string sortExpression) { return this._lastCustomers.MaxRowIndex; } }
For some reason the GetData method is always called twice.
It's called twice when the page loads and twice everytime I page.No grid events are being handled in the code behind.
I have two questions:1) How can I stop the GetData call being made twice.2) Why does the return object of GetData need to inherit IHierarchicalList. I can do theGrid.DataSource = theCustomers, where theCustomers is of type CUstomers, and it works fine...but returning a Customers object gives an error when using the ISDataSource saying the collection must implement IHierarchicalList. This means I have to take my customer objects and add them to a special collection before I return them.
1) The GetPagedBugs (if you see ClientBiding_Paging.aspx sample) is being called twice indeed.This happen due to the sample is using pagination feature. First, it will select all data then it will select again for the paging.
2) If you are using Intersoft sample, it should use IHierarchicalList indeed, because data source collection of the sample is using hierarchical collection.If you don’t the hierarchical collection, you should your own data source collection.
Thank you.
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