Getting a DataTable from server and working with it in Javascript (VB.NET)

For any Asp.NET developer one of the most common scenarios is retrieving data in form of a DataTable from server (unless, you are dead serious about using data reader 🙂 ). So how to do it with Atlas and avoid postback… quite simple actually.

First what you need to do is create a web service file which you will use to retrieve data. To do that, you would go to Visual Studio (assuming you have created a web site already), right-click on your web site in Solution Explorer, then click “Add new item”. Choose “Web Service”, name it GetData.asmx and make sure to uncheck the “Place code in separate file” checkbox.

Make that file look like this :


Now when we have our web service set up, we’ll go to the .aspx page and retrieve that data with atlas. I’m assuming here you know the basics of Atlas, so I won’t go into details. Just remember to put a script manager tag just
under your body tag… should look something like this (make sure you set the service reference to the webservice you’ve just created) :


…Now, we are all set to go into javascript and write the code to get the DataTable. You will basically have two functions, one that will call the function we’ve made in our web service, and other that will receive the datatable as a parameter from our web service functions. It will look something like this :


And that’s all there is to it. No postbacks 🙂 You may want to read this great “Quick Reference for the Atlas DataTable” by Garbin (my advice is to read pretty much anything where you see Garbin underneath, this guy rocks!).Ohh yeah, if I messed up something while writing this post or you have trouble to get it working, feel free to contact me.

This blog is being delivered to you by
“Do you know what your employees are blogging about?”


4 Responses to “Getting a DataTable from server and working with it in Javascript (VB.NET)”

  1. Ray Says:

    I can’t get this code to work with latest AJAX 1.o. I keep on getting a circular reference issue when invoking the webservice method. I tried uncommenting the jsonSerializer section in web.confg and all I get is that it can’t find the method to execute…so frustrating..

    MyAtlas.Demo.getTravelData.GetData(“DC”, OnComplete, OnError);

    The above method is supposed to return a datatable…what could I be doing wrong…thanks..

  2. steroids Says:

    Great information… thanks for you review and tutorial about how to comment.
    I think if we walk to other blog we most comment to give appreciate for owner.

  3. steroids pharmacy Says:

    I just found this blog and have high hopes for it to continue.
    Keep up the great work, its hard to find good ones. I have added to my favorites. Thank You.

  4. Steroids Says:

    Now, we are all set to go into javascript and write the code to get the DataTable.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: