[RESOLVED] How to populate datatable in separate thread

suppose i have gridview in main thread and i want to populate datatable in another thread and populate my grid in main thread. is it possible....if yes then plzzz help me with source code.

hi

very nice question...i want to know too...

any idea?

If you want to load the data in another thread, to improve the responsiveness of the application, then you've really only two options:

1. Call the database reads in background in the code-behind. However, since you have to wait for the data before you can fill the grid you're not gaining anything; in fact you're probably harming the server resources.

2. Load the page, then asynchronously load the data. This gives the impression of a more responsive UI; the user still has to wait for the data, but they see something happening.

If you want the second approach then you have to do no data loading in the page (in chode behind), but load the page and in script, when the page has loaded in the client, create a call back to the server to get the data. You then have to extract the data and format it for display (since it's just raw data). The alternative is that you call a method that loads the data into the gridview and gets the gridview to render its HTML, then sends that back to the client. All-in-all you're giving yourself much more work that way.

Loading data asynchronously from the client can be very effective, but you have to do more script work and format the data. This can be achieve fairly easily with jQuery (http://jquery.com/) and things like Knockout (http://blog.stevensanderson.com/2010/07/05/introducing-knockout-a-ui-library-for-javascript/).

can u plzz come with example code of two way. thanks

thoughts on "[RESOLVED] How to populate datatable in separate thread "

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>