Tutorials to .com

Tutorials to .com » Asp » Optimization » Use data binding to achieve an efficient dynamic pages (Author: Chen Yuan at 10:06 on December 25, 2000)

Use data binding to achieve an efficient dynamic pages (Author: Chen Yuan at 10:06 on December 25, 2000)

Print View , by: iSee ,Total views: 11 ,Word Count: 2067 ,Date: Fri, 17 Apr 2009 Time: 9:04 PM

Data binding (Data Binding) is not a new concept, IE 4.0 was to give them a wealth of support. However, data binding has not been given due attention, many developers seem to be more willing to use server-side scripting (Server Script) method. However, in practice, whether it is in a dynamic web page code or in the efficiency of dynamic pages, the data binding efficiency higher than the latter.

This article introduces data binding architecture, working principle and its implementation modalities, the last of these two methods work in programming and web pages to make efficiency comparisons and conclusions.

First of all, let us look at a simple example. A page of the current warehouse inventory, the user can choose to sort the data by: name of goods, prices, inventories, etc. to sort. The use of server-side technologies such as CGI, ISAPI, or ASP, such as middleware, the user who needs to sort N species, the application server script to submit at least N times the data request. For the same data content, just because of the different display, we conducted a number of database operations, spent a lot of network bandwidth.

Another common example is the need for large amounts of data page is displayed, each page will need to re-establish a connection to the server to submit queries, and then positioning data. Of these similar problems, data binding provides an efficient solution.

Data binding architecture and working principle of data binding <br> architecture includes four components: the data source object (Data Source Object), data objects (Data Consumers) and the two proxy (Binding Agent and Table Reptition Agent). Data source object to the web site provides data, statistics show that the object is to display HTML data elements to ensure that proxy was used to synchronize the work of the first two. Figure 1 shows the four parts of this principle to work together.

As shown in Figure 1, data source object with the back-end database server and the DB Server to return to the form of data collection in the local cache Cache. Thereafter, this data set any operation, such as sorting, filtering, take a subset, are in the local Cache conducted by the Agent to be responsible for the data source and display the HTML elements of the data communication and synchronization between.

http://www.ccidnet.com/tech/web/2000/12/25/image/001225i1-1.jpg
Figure 1

This data binding work, making the procedure as long as the developers to extend the use of HTML and can be inserted into the data source object, the script will be able to reach the minimum amount of programming. With the traditional server-side script-generated pages compared to the data as long as a download to the client after any of the data are no longer required to operate an additional server request, thus saving the network bandwidth and improve the download speed.

The realization of data binding in accordance with this section <br> data binding architecture, introduced the various components of it and its implementation.

1. The data source object (Data Source Object)

The first step in the realization of data binding are: to determine the page to display data by which to select a suitable data source object (DSO), and then quoted in the pages of the DSO. First of all the flexibility of data binding performance in support of a wide range of DSO, IE 4.0 and above DSO version supports the following types:

● Tabular Data Control (TDC): This is a simple DSO, provide access to a text file format. In other words, TDC provides data source is specified separator to a text file format.

● Remote Data Service (RDS): RDS, formerly known as ADC (Access Data Control). RDS through OLE-DB or ODBC database communications, access to data.

● JDBC DataSource Applet: with RDS is different from the database connection using JDBC.

xml Data Source: Extensible Markup Language xml using the standard way to describe and exchange structured data; xml data with an open, text-based description of the format and transmission through a standard HTTP protocol. The nature of XML itself, it is a flexible and powerful nature of the DSO. java APPLET use IE4.0 to achieve XML DSO; IE5.0 support the Data Island, users can directly use the definition of the data tag <XML> as DSO.

● MSHTML Data Source: In addition to the use of external control as a DSO, the developer can also be defined in the HTML document data sets, and the use of MSHTML itself as a data source.

● Since the definition of the type of DSO: In addition to the above five categories defined in this DSO, IE also supports user-defined types of DSO, the DSO to follow as long as IE 4/MSHTML Data Binding interface can.

DSO can be specified in the design can also be an increase in the dynamic run-time, modify, and delete.

2. In support of data binding to data objects (Data Consumer)

HTML elements can be bound is divided into two categories: single-value objects (Single-valued Consumer) and table objects (Tabular Consumer). DSO object shows a single value of the current record provides a domain, and the target table element in each row is a record corresponding to a different domain, and repeated this as a template for each data record. Data object can be designed to bind to DSO, can also be dynamic binding at runtime.

DSO and Data Consumer's dynamic characteristics, the binding elements that already exist can be modified; Not only that, dhtml Object Model (DHTML Object Modle) also supports the increase in run-time dynamic data binding elements and the data source object, so the data can vary step-by-step way to download to the client. The characteristics of allowing developers to reduce page download time to initialize the content and pages in a number of different data sets show that the content of the interactive user will receive a high-quality services.

Support for data binding, including the HTML elements: A, Applet, Button, Div, Frame, Iframe, Img, Input (including Checkbox, Hidden, Label, Password, Radio, Text and other types), Label, Marquee, Select, Span and Textarea . Of which, A, Button, Div, Img, Frame, Iframe, Lable, Marquee, as well as to support the span of the read-only data binding features; and Input (apart from foreign Button type), Select, Textarea, Object and Applet support by binding of data elements The Update function.

3. Data binding support for the operation of

For read-only type of Data Consumer, the data binding support for the operation is to show the DSO to provide the data sets. Specific features include:

● to increase and modify the dynamic binding elements and DSO, such as changes in data fields shown in the data set, such as filtering and sorting.

● Dynamic changes in the display of data sets, data format can be HTML, Text can also be a simple format.

● Dynamic Control of the amount of data being displayed, you can dynamically change the page display when the page contains the number of records.

Update function to support the Data Consumer has not only support the above functions, the record also supports the increase, modify, and delete. In other words, the user interaction page of data to increase, modify, and delete, will affect the data showed that the binding elements of the data sets. In order to facilitate control of the data sets, data binding allows developers to use ADO (Active Data Objects) to provide all the methods and properties to maintain data sets provided by DSO, including the Insert, Update, Delete and Navigation and more.

Data binding a very important issue is that must be made clear to the Data Consumer operations which affect the data in the end: It is only the data in the local Cache work, or has been a real change in the back-end database (with DSO the type). TDC, XML Data Source, as well as only MSHTML Data Source support for the Cache data changes, rather than support the change in the data in the Cache to the data source by connecting the back-end database. And RDS and support for JDBC DataSource Applet modify the function of the back-end database.

<br> Comparisons and conclusions can be seen from Table 1, compared with the server-side scripting, data-bound web pages generated by improved efficiency. However, programmers using the method of demanding the need for a deep understanding of Data Binding in order to give full play to its excellent properties. The complexity of the work efficiency is high to pay, in the applications, developers should be based on specific needs and the actual situation, select the appropriate method or combination of the two in order to obtain the highest price-performance ratio.

Table 1


Comparison Program

Data Binding

Server-side scripting

The efficiency of the page

Data download

Synchronous / asynchronous

Synchronization

Data filtering or sorting

Only to establish a connection

n operations n times to establish connections

Page Display

Only to establish a connection

Each page needs a new connection and positioning data

Through the database directly modify the data consumer

Support, and no programming

Support, subject to programming

Conclusion

Download speed obviously improved, and fast user interaction to provide quality services

Download speed slower than with the interactive way data binding

Programming efficiency

Programming flexibility

High

High

Programming workload

Less

More

Programming complexity

High

Low

Conclusion

Less programming, the use of a flexible. However, programmers must be familiar with the requirements dso and supported by the data consumer of special methods and properties, than the server-side scripting programming complex

Although the programming workload, but the use of flexibility and convenience, just familiar with the operation of the general database programmers can do


Asp Optimization Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.