To familiarize you with plenty of controls and concepts
concerning data binding on the client side, we have constructed a simple and integrated
sample - AJAXCTPDev311. Let us summarize
the important features with it.
·
It provides an integrated framework to create the basic MS AJAX
data binding applications.
·
To create the website we have chosen to use the "ASP.NET
AJAX CTP-Enabled Web Site" template; however, you can also use the common
"ASP.NET AJAX-Enabled Web Site" template, but you have to add the
assembly Microsoft.Web.Preview.dll (supporting
xml-script programming and data binding) manually.
·
Whatever kinds of MS AJAX applications you are to create, the ScriptManager
control plays the core role of whole AJAX architecture—from the client side to the server side. In general, we should explicitly
specify the web service related *.asmx files and the assemblies we use. Here we
again list this related piece of code.
Listing 1
<asp:ScriptManager ID="ScriptManager1" runat="server" >
<Services>
<asp:ServiceReference Path="BookDataService.asmx" />
</Services>
<Scripts>
<asp:ScriptReference Assembly="Microsoft.Web.Preview" Name="PreviewScript.js" />
</Scripts>
</asp:ScriptManager>
·
The ListView (and ItemView—to
be used in the third sample) control has several templates, which are in turn associated
with a set of div elements which may contain most of
the basic HTML elements such as button, textbox, span, hyperlink, etc. Altogether
to use ListView and ItemView, you have to earnestly analyze and grip the
relationships between the templates and the div elements.
·
The declarative mode is a new and good approach of programming on
the client side, which is to be studies in the next section.
·
The following diagram reveals the relations among the several key
components we used.
Figure 1: The different data form transferred
between the key components
Note here: First, the data form transferred among ListView,
DataSource and WebService are different; second, the WebService generally
provides data from databases—the rectangle
with broken lines here only means we have not used this form (to be examined in
the third sample later on).
·
We have used a special kind of WebService—DataService to provide data to ListView
from the server side.
·
We have used the methods of WebService directly from the client
side, have not we? This is a great change MS AJAX has brought to us.
Now, let us look more closely at the declarative mode with xml-script.