Thursday, May 24, 2012

JSON Web Service - DataTable

I found a great article on how to pull ADO.Net DataTable in an XML web service and return JSON table.

This is a VERY good read - easy to understand.  This is a good place to start when first pulling data from table... for JSON to use.

And if you want to pull JSON data from code behind, it is easy to.. If the data is only used on one page, why expose a web service api to it...

Notice how it is decorated with [ScriptService]

After doing this, you may consider enhancing.

You can make an array of serializable objects... instead of a Jagged array.   Just apply the JavaScriptSerializer to it.

Putting it together...

If you are binding a Linq Query to Kendo UI, (using JSON) here is an awesome resource:

It tells all sorts of goodies - like what references to make... etc.  It is MVC, if you use that.  If not, you have to adjust somewhat.

No comments:

Post a Comment