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 connecting a webgrid to a table that contains about 100,000 records via an ObjectDataSource. I'm doing my own server-side paging by:
1) setting pagingloadmode="custom" in my webgrid2) setting assigning SelectMethod and SelectCountMethod in my ObjectDataSource.3) Making sure my SelectMethod has the 3 required parameters (startrowindex, maximumrows, sortexpression)
So far, so good. My webgrid selects only 100 records at a time, and sorting works fine.
Now I want to allow the user to be able to filter on any column in the webgrid. However, using only the built-in feature of the webgrid causes some problems.
1) my total (filtered) rowcount to be incorrect - It never updates from the total (unfiltered) rowcount.2) my grid doesn't show the first 100 filtered records. It shows only the subset of the first 100 records that match my filter. Or, if I scroll down to get a second page of data (which would show rows 1 through 200 if I had no filter)
Do I have to force the webgrid to rebind in order to get the correct number of total rows that match my filter? Where would I do this? Also, do I have to try to recreate the filter syntax by iterating through each of the filteredcolumns in my webgrid's roottable?
I've tried to do just that by iterating through all the webgrid's roottable's filteredcoulmns and creating filter syntax that my database would accept within objectdatasource1_selecting. I then add this filter to my httpcontext.current.items. Within my SelectMethod (which has to have only startrowindex, maximumrows, and sortexpression since it is used by my objectdatasource), I grab the filter syntax from my httpcontext.current.items and pass it to my stored procedure.
How do I then rebind my webgrid so the total matching rows is properly updated?
Thanks - and I'm sorry if this is a bit confusing!
Brian
For such scenario you could add a filter expression as a SelectParameter in the ObjectDataSource. The filter expression will hold all the WebGrid filter value. This filter expression will accept the filter syntax you created.
You will also need to modify the select method and selectcount method so it will accept the filter expression parameter.
public DataTable GetData(string FilterExpression, int startRowIndex, int maximumRows, string sortExpression)public int GetCount(string FilterExpression, string sortExpression)
The ObjectDataSource select parameter:
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="dsNorthwindTableAdapters.CustomersTableAdapter" UpdateMethod="Update"> <SelectParameters> <asp:Parameter Name="FilterExpression" DefaultValue="" /> </SelectParameters> ...</asp:ObjectDataSource>
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