SYSK 229: AJAX.NET Update Panel or Web Service?

AJAX.NET has two methods for incrementally updating user interface of a web page – UpdatePanel and .asmx/.svc programming model. So, which should you choose when?

 

If you need to have access to the view state of your server side controls, including the page itself, then use UpdatePanel. It’s very simple to use – just add UpdatePanel control as an outer element of the UI that requires partial updates, set some properties using declarative code and you’re done. The drawback is that UpdatePanel performance a full page postback, and it can only execute one request at a time to assure ViewState integrity.

 

If your server-side logic is stateless, use a web service call. AJAX.NET makes it a lot simpler than writing XMLHttpRequest code from scratch, but you still have to write just a bit of client script code to extract data from UI and pass it as parameters to the web method. The advantage of using a web service is that it only sends the minimum amount of data (i.e. light-weight), and you can execute multiple requests in parallel.