Accessing Server-Side Data from Client Script (Part 1)

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
When building a web application, we must decide how and when the browser will communicate with the web server. The ASP.NET WebForms model greatly simplifies web development
by providing a straightforward mechanism for exchanging data between the browser and the server. With WebForms, each ASP.NET pages rendered output includes a
Code:
<form>
element that performs a <i>postback</i> to the same page whenever a Button control within the form is clicked, or whenever the user modifies
a control whose
Code:
AutoPostBack
property is set to True. On postback, the server sends the entire contents of the web page back to the browser, which then
displays this new content. With WebForms we dont need to spend much time or effort thinking about how or when the browser will communicate with the server or how that
returned information will be processed by the browser. It just works.

While this approach certainly works and has its advantages, its not without its drawbacks. The primary concern with postback forms is that they require a large amount
of information to be exchanged between the browser and the server. Specifically, the browser sends back all of its form fields (including hidden ones, like view state,
which may be quite large) and then the server sends back the entire contents of the web page. Granted, there are scenarios where this large quantity of data needs to
be exchanged, but in many cases we can use techniques that exchange much less information. However, these techniques necessitate spending more time and effort thinking
about how and when to have the browser communicate with the server and intelligently deciding on what information needs to be exchanged.

This article, the first in a multi-part series, examines different techniques for accessing server-side data from a browser using client-side script. Throughout this
series we will explore alternative ways to expose data on the server so that it can be accessed from the browser using script; we will also examine various tools
for communicating with the server from JavaScript, including jQuery and the ASP.NET AJAX library. Read on to learn more!

http://www.4guysfromrolla.com/articles/102010-1.aspx" class="readmore Read More >

View the full article
 
Back
Top