Using JSON in ASP.NET
If you’ve been avoiding using JSON in your ASP.NET application because you think it’s hard, you’re an idiot. I can say that, because I’ve been avoiding it for exactly that reason. I’ve been an idiot too. But no more! Using an UpdatePanel is still easier than JSON. But JSON is easy enough that you may decide to use it over the UpdatePanel under certain circumstances.
The main problem with the UpdatePanel, as most know by now, is that all of the form data gets posted to the server and all of the server code runs during every update. While there are ways of detecting that the UpdatePanel is causing the postback and thereby limiting the amount of code that runs on the server, you are still left with a full submit of the client form elements to contend with. On a large form, and a form with a lot of view state information, this could be a huge consideration.
JSON, on the other hand, only sends the data that is needed for the WebService function it is calling and only returns the data that the WebService function returns. So you end up sending less data, executing less code on the server, and returning less code from the server. This can significantly increase the performance of your application as well as increase the scalability of your application.
However, it will take a lot more work to JSON-enable something like the GridView. In that case, you may decide that the cost of the development outweighs the performance gains of JSON and decide to stay with the UpdatePanel. There are places for both in your toolbox.
Other Related Items:
Life on LifeJson, known for his gritty punchlines and heartfelt lyrics, has been able to to reach the streets as well as edify the church with his career in minis... Read More >
AJAX Grip Black Pearlite Beretta 92/96AJAX Grip Black Pearlite Beretta 92/96











[...] Using JSON in ASP.NET (Dave M. Bush) [...]
[...] week I wrote a post about how simple JSON is. In it I explained the main differences between using JSON and using the update panel. [...]