Q08.Load
is an asynchronous method. After you call it, the third statement, Q08.First
is immediately executed, but the dataset is not loaded yet.
You have two options:
-
Call
Load
and then put the rest of your code in theAfterOpen
event. That's the event executed after the asynchronousLoad
operation is finished. -
Use
TXDataWebClient
to retrieve data from the server directly using more flexible methods (likeList
).TXDataWebClient
also provides you withasync
-flagged methods, meaning you can call them usingawait
. There is a demo in XData installation folder (\demos\web\clientAsync
) that shows how to use it. Once you get data from the client, you can put it in the dataset usingSetJsonData
and then you can callOpen
to iterate through the dataset.
But honestly, if you want to bind your data manually to a control, I don't see a need for the dataset. Just get the data from the server using TXDataWebClient
, and build your grid directly using the retrieved objects.