I have an existing win application that is using WinGrid with DataSet. Now we plan to improve it. We want to use load-on-demand to improve its efficiency. We know there is a UltraDataSource and everytime a data is not found it will called UltraDataSource1_CellDataRequested().
But we don't know how to add this UltraDataSource into our existing structure and how the existing SQL must be changed to use the load-on-demand feature. Could anybody help?
UltraDataSource doesn't load data from SQL. It relies on you to load the data. So, unless you have some way to load only the data you need from the back end, there probably isn't much advantage for you here if you are already loading your data into a DataSet.
Also note that if you sort or filter the grid, or have summaries applied, then the grid will be forced to load all of the data and thus defeat any benefit you might have gained from loading on demand.
The NetAdvantage SDK includes a sample called Virtual Mode Sample, which is under the UltraDataSource samples and it demonstrates loading a WinGrid on-demand with some dummy data. The grid in this sample has 1 million rows in it.The data in the sample is just a bunch of randomly generate numbers. In your case, it would come from some real data source, like your data set.
If you want to improve the efficiencly of your application, I recommend that you take a look at this: WinGrid Performance Guide