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
I am using the WebGrid in two scenarios, one where the columns are known and added in the aspx page and the other where the columns are dynamic and not known and in that case we rely on the RetrieveStructure method. In some cases, we are sorting the grid at runtime via Me.RootTable.SortedColumns.Add(New WebGridGroup("PersonName", 2)). When we run this code and the columns are known at design time, it works fine, i.e., the grid is sorted correctly. In the cases where we have to call RetrieveStructure, on the other hand, and we run the same code, the grid is not sorted on the columns that we specify. So my question is: when we have a grid where the columns are not specified, at what point do we call Me.RootTable.SortedColumns.Add()??? A second question is whether or not there is some other code that needs to be executed in RetrieveStructure scenarios in order to sort.
Thanks,
Brad
Thanks Glenn. I was able to get this to work. The key, it seems, is that the addition of columns to the various filter collections needs to take place in PrepareDataBinding. That was the difference.
Hello Brad,
If the columns are not specified, what do you need sort for? Only when column structure is specified, you can use sort. I think you can do yor sorting after you called RetrieveStructure. If you specified the sort before RetrieveStructure, of course WebGrid would not sort.
Regards,Handy
Handy,
The columns are ultimately specified; what I meant is that they're not specified in the aspx page but, rather, RetrieveStructure() is used to specify the columns. We have some scenarios where the same WebGrid is used for a couple of different searches and we display the different result sets in the same WebGrid. Then the user is allowed to save their preferences, both their form field entries which generate the results, as well as the field(s) that they sorted on, columns that they filtered on, etc. So, we want our users to be able to load one of the reports that they have saved in this manor, call "RetrieveStructure" and then apply the filters via SortedColumns.Add() but it doesn't seem to work. It doesn't work if I call it before or after RetrieveStructure. Is there a way to accomplish this goal? This same process does work in situations where the columns are added to the grid without RetrieveStructure.
Attached is a simple sample of WebGrid with programatic data bind and retrieve structure functionality. It is demonstrated that adding the field to sorted column collection after retrieve structure will sort the WebGrid data.
The data binding is performed in the InitializeDataSource server side event handler, while the retrieve structure will be performed during the PrepareDataBinding server side event handler.
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