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
Hello,I bind WG to ObjectDataSource ,
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnablePaging="true" MaximumRowsParameterName="maximumRows" SelectCountMethod="GetAllCount" SelectMethod="GetData" TypeName="ObjectDataSourceFilteringSample.DataItem"> <SelectParameters> <asp:Parameter Name="FilterExpression" Type="String" /> </SelectParameters> </asp:ObjectDataSource>
Pagging works almost perfect but when I go to second page ( from first to second or from third to second it doesn't matter) rows in change don't change , number of page change, when I click RefreshData button all rows disappear. I check selectMethod it return correct rows, and in another function where is another pagging logic also second page doesn't show proper no matter of page size. public List<Item> GetData(string FilterExpression, int startRowIndex, int maximumRows, string sortExpression) Second problem is filtering with customPagging. Parameter FilterExpression is always null, I don't know how to pass what users type in web. I attach a simple solutions with both issue.
Sample Code
There are three general types of client data source:
The exporting functionality needs to be processed at server-side. By nature, only server-side data source type which produce export result without any issues.
However, there is a trick to have such feature work on the other two types of client data source (the service-based data source and client-side data source). In order to export the data when service-based data source or client-side data source is used, the BindingOperationMode should be modified back to “ServerBinding” temporarily.
We can utilize the OnBeforeRequest client-side event to modify the property only when the action is “Export”. Please try to add following code inside the OnBeforeRequest client-side event.
function WebGrid1_OnBeforeRequest(controlId, action) { var WebGrid1 = ISGetObject(controlId); if (action == "Export") WebGrid1.BindingOperationMode = "ServerBinding"; return true; }
Add the data source on WebGrid’s InitializeDataSource server-side event.
protected void WebGrid1_InitializeDataSource(object sender, ISNet.WebUI.WebGrid.DataSourceEventArgs e) { dsNorthwind.ProductsDataTable dt = new dsNorthwind.ProductsDataTable(); dsNorthwindTableAdapters.ProductsTableAdapter da = new dsNorthwindTableAdapters.ProductsTableAdapter(); da.Fill(dt); e.DataSource = dt; }
Last, configure the BindingOperationMode property back to “ClientBinding”.
function WebGrid1_OnBeforeRequest(controlId, action) { var WebGrid1 = ISGetObject(controlId); if (action == "Export") WebGrid1.BindingOperationMode = "ServerBinding"; else WebGrid1.BindingOperationMode = "ClientBinding"; return true; }
Hope this helps.
Pagging works almost perfect but when I go to second page ( from first to second or from third to second it doesn't matter) rows in change don't change , number of page change, when I click RefreshData button all rows disappear. I check selectMethod it return correct rows, and in another function where is another pagging logic also second page doesn't show proper no matter of page size.
Please try to set the PagingDataRetrievalMode property to “ReturnPartialRows”. This property gets or sets the data retrieval mode when classic paging is used and paging load more is set to Custom.
<ISWebGrid:WebGrid ID="WebGrid1" runat="server" Height="250px" UseDefaultStyle="True" Width="500px" DataSourceID="ObjectDataSource1"> <LayoutSettings PagingMode="ClassicPaging" PagingLoadMode="Custom" PagingSize="3" PagingDataRetrievalMode="ReturnPartialRows" /> ... </ISWebGrid:WebGrid>
Second problem is filtering with customPagging. Parameter FilterExpression is always null, I don't know how to pass what users type in web.
I need more time in order to provide you with solution, suggestion, or sample. I’ll get back to you as soon as possible.
Thanks for answer, the first issue is solved so I'm looking forward to hearing from you soon about the second one.
Best regards,
Michal
It seems that the Select method in custom paging scenario doesn’t accept FilterExpression parameter. That should explain why does the FilterExpression parameter is always null.
I suggest you to try PagedData mode of Data Loading Mode in WebGrid 7’s ClientBinding scenario. When data operation - such as sorting and filtering - is performed in PagedData mode, WebGrid will send a request to the specified data service by including complete request data in the selectArguments parameter. Developers are responsible to handle the sorting, filtering and paging based on the select arguments. In addition, WebGrid will also send a SelectCount request when it needs to invalidate the paging status.
ClientBinding encapsulates essential select arguments into an object called DataSourceSelectArguments. This object is always passed to the parameter of your Select method.
For more detail information, please check the “Data Loading Mode” topic in WebGrid’s documentation.
Could I use ClientBinding and PaggedData with ObjectDataSource ?
The PagedData mode of Data Loading Mode in WebGrid’s 7 ClientBinding scenario works for client-based data service.
I use ClientBingdigMode with WebService and filtering and pagging works but when i try to export data to any format i've got JS error: "Invalid client service command"
dynamic js code
I was able to reproduce the problematic behavior on my local end. I will have this forwarded to WebGrid development team to be investigated further. Should I hear any news from the team regarding this issue, I will let you know as soon as possible.
Any news?
Glad to hear that the trick helps.
Should you need further assistance or run into any problems regarding our controls, feel free to post it into our forum. We would be happy to assist you again.
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