Beginning Ajax with ASP.NET- P11
Số trang: 15
Loại file: pdf
Dung lượng: 393.00 KB
Lượt xem: 11
Lượt tải: 0
Xem trước 2 trang đầu tiên của tài liệu này:
Thông tin tài liệu:
Beginning Ajax with ASP.NET- P11:Thank you for purchasing Beginning Ajax with ASP.NET. We know that you have a lot of options whenselecting a programming book and are glad that you have chosen ours. We’re sure you will be pleasedwith the relevant content and high quality you have come to expect from the Wrox Press line of books.
Nội dung trích xuất từ tài liệu:
Beginning Ajax with ASP.NET- P11Chapter 5Summar y In this chapter, you examined several topics related to data communication. ❑ XML — XML contains the raw data of a data transfer. It is human- and computer-readable in a language-independent format. ❑ XSLT — XSLT is used to transform information from one XML format into another. ❑ X Path — X Path is used to navigate within an XML/XSLT document. ❑ JSON — JSON is a human- and computer-readable data interchange format that is less complex then XML. These topics form an important basis for heterogeneous communications, such as that used in Ajax and between a web client and a web server. Knowing how XML, XSLT, and JSON are structured can be very valuable as a basis of a custom Ajax library, for getting data between a web client and a web server, or for being able to diagnose a problem in an existing library. You can find more on the topics discussed in this chapter at the following sites: ❑ Wikipedia — http://en.wikipedia.org/wiki/XML ❑ “SGML Source” by Charles F. Goldfarb — www.sgmlsource.com ❑ World Wide Web Consortium (W3C) — www.w3c.org ❑ W3 Schools web site — www.w3schools.org ❑ JSON web site — www.crockford.com/JSON126 6 What Is Built into ASP.NET ASP.NET 2.0 contains an incredible amount of enhancements over ASP.NET 1.0 and 1.1. The ASP.NET team has attempted to address various areas that required improvement in previous versions, and the inclusion of Ajax-style functionality is one of those areas. ASP.NET 2.0 contains a technology called Asynchronous Client Script Callbacks, or simply callbacks for a shortened name. As the name suggests, this offers the ability for ASP.NET to directly support the inclusion of JavaScript code that enables asynchronous calls to the server for processing — that is, to execute a server method asynchronously from within the browser and have ASP.NET instruct the browser to execute a JavaScript callback method when the server method completes. In this chapter, you take a look at: ❑ Server controls included with ASP.NET V2.0 that support asynchronous callback functionality ❑ Enabling your pages to support asynchronous behavior using callbacks in ASP.NET V2.0 ❑ Using advanced techniques to develop controls that support asynchronous behavior, using client callbacksOut-of-the-Box Controls Before you delve into the fundamentals and implementation of these features, it is important to note that some web controls that ship with ASP.NET come with the ability to support callback functionality. Specifically, these controls are the: ❑ TreeView ❑ GridView ❑ DetailsView These controls come with simple boolean properties that enable the use of asynchronous callbacks in a browser-friendly way, without the need to know or write any JavaScript at all.Chapter 6 Again, before the chapter gets too technical, have a look at how easy it is to make use of Asynchronous Client Script Callbacks by using some of the controls that support this technology natively.TreeView Control The TreeView control allows hierarchical navigation over any datasource. A very common use of this control is to act as a navigation control for web sites. This is easily achieved by binding the TreeView control to a SiteMapDataSource control. However, for the purposes of this example you are interested in the built-in ability to provide asynchronous callback functionality to your applications. Examine the following simple ASP.NET page:Try It Out TreeView Control Utilizing Asynchronous Client Script Callback Support Treeview Asynchronous Example This page contains a TreeView control and an XmlDataSource control. The XmlDataSource control provides data from an XML file named TestXMLFile.xml. This file has the following contents: 128 What Is Built into ASP.NET How It Works From the example data shown in the preceding block, the nodes Node1, Node2, Node3, and Node4 will be displayed by the TreeView control. When one of these nodes is clicked or selected, the TreeView requests the subnodes for the selected node from the datasource. By default, when the TreeView control is dropped onto a page using Visual Studio .NET 2005, asynchronous callback functionality is enabled. The EnableClientScript property determines this behavior and is set to true by default. The effect that this has is that when a node within the TreeView is clicked and that node has some subnodes within it that need to be loaded from the datasource, an asynchronous callback is performed to retrieve the data or list of subnodes in this case. The user does not see the web page postback to the server. If you were to change the preceding web page code so that the markup for the TreeView control looked like: this would then tell the TreeView control to not attempt to use client script to retrieve the extra data it requires. Each time a node is expanded in this case, you would notice that the browser performs a post- back. Obviously, causing a postback is not as seamless an experience as performing a callback, where no user experie ...
Nội dung trích xuất từ tài liệu:
Beginning Ajax with ASP.NET- P11Chapter 5Summar y In this chapter, you examined several topics related to data communication. ❑ XML — XML contains the raw data of a data transfer. It is human- and computer-readable in a language-independent format. ❑ XSLT — XSLT is used to transform information from one XML format into another. ❑ X Path — X Path is used to navigate within an XML/XSLT document. ❑ JSON — JSON is a human- and computer-readable data interchange format that is less complex then XML. These topics form an important basis for heterogeneous communications, such as that used in Ajax and between a web client and a web server. Knowing how XML, XSLT, and JSON are structured can be very valuable as a basis of a custom Ajax library, for getting data between a web client and a web server, or for being able to diagnose a problem in an existing library. You can find more on the topics discussed in this chapter at the following sites: ❑ Wikipedia — http://en.wikipedia.org/wiki/XML ❑ “SGML Source” by Charles F. Goldfarb — www.sgmlsource.com ❑ World Wide Web Consortium (W3C) — www.w3c.org ❑ W3 Schools web site — www.w3schools.org ❑ JSON web site — www.crockford.com/JSON126 6 What Is Built into ASP.NET ASP.NET 2.0 contains an incredible amount of enhancements over ASP.NET 1.0 and 1.1. The ASP.NET team has attempted to address various areas that required improvement in previous versions, and the inclusion of Ajax-style functionality is one of those areas. ASP.NET 2.0 contains a technology called Asynchronous Client Script Callbacks, or simply callbacks for a shortened name. As the name suggests, this offers the ability for ASP.NET to directly support the inclusion of JavaScript code that enables asynchronous calls to the server for processing — that is, to execute a server method asynchronously from within the browser and have ASP.NET instruct the browser to execute a JavaScript callback method when the server method completes. In this chapter, you take a look at: ❑ Server controls included with ASP.NET V2.0 that support asynchronous callback functionality ❑ Enabling your pages to support asynchronous behavior using callbacks in ASP.NET V2.0 ❑ Using advanced techniques to develop controls that support asynchronous behavior, using client callbacksOut-of-the-Box Controls Before you delve into the fundamentals and implementation of these features, it is important to note that some web controls that ship with ASP.NET come with the ability to support callback functionality. Specifically, these controls are the: ❑ TreeView ❑ GridView ❑ DetailsView These controls come with simple boolean properties that enable the use of asynchronous callbacks in a browser-friendly way, without the need to know or write any JavaScript at all.Chapter 6 Again, before the chapter gets too technical, have a look at how easy it is to make use of Asynchronous Client Script Callbacks by using some of the controls that support this technology natively.TreeView Control The TreeView control allows hierarchical navigation over any datasource. A very common use of this control is to act as a navigation control for web sites. This is easily achieved by binding the TreeView control to a SiteMapDataSource control. However, for the purposes of this example you are interested in the built-in ability to provide asynchronous callback functionality to your applications. Examine the following simple ASP.NET page:Try It Out TreeView Control Utilizing Asynchronous Client Script Callback Support Treeview Asynchronous Example This page contains a TreeView control and an XmlDataSource control. The XmlDataSource control provides data from an XML file named TestXMLFile.xml. This file has the following contents: 128 What Is Built into ASP.NET How It Works From the example data shown in the preceding block, the nodes Node1, Node2, Node3, and Node4 will be displayed by the TreeView control. When one of these nodes is clicked or selected, the TreeView requests the subnodes for the selected node from the datasource. By default, when the TreeView control is dropped onto a page using Visual Studio .NET 2005, asynchronous callback functionality is enabled. The EnableClientScript property determines this behavior and is set to true by default. The effect that this has is that when a node within the TreeView is clicked and that node has some subnodes within it that need to be loaded from the datasource, an asynchronous callback is performed to retrieve the data or list of subnodes in this case. The user does not see the web page postback to the server. If you were to change the preceding web page code so that the markup for the TreeView control looked like: this would then tell the TreeView control to not attempt to use client script to retrieve the extra data it requires. Each time a node is expanded in this case, you would notice that the browser performs a post- back. Obviously, causing a postback is not as seamless an experience as performing a callback, where no user experie ...
Tìm kiếm theo từ khóa liên quan:
nhập môn lập trình kỹ thuật lập trình lập trình flash lập trình web ngôn ngữ html lập trình hướng đối tượngGợi ý tài liệu liên quan:
-
Đề cương chi tiết học phần Cấu trúc dữ liệu và giải thuật (Data structures and algorithms)
10 trang 301 0 0 -
Giáo trình Lập trình hướng đối tượng: Phần 2
154 trang 254 0 0 -
Kỹ thuật lập trình trên Visual Basic 2005
148 trang 244 0 0 -
101 trang 193 1 0
-
NGÂN HÀNG CÂU HỎI TRẮC NGHIỆM THIẾT KẾ WEB
8 trang 179 0 0 -
Giới thiệu môn học Ngôn ngữ lập trình C++
5 trang 177 0 0 -
Luận văn: Nghiên cứu kỹ thuật giấu tin trong ảnh Gif
33 trang 146 0 0 -
Bài giảng Nhập môn về lập trình - Chương 1: Giới thiệu về máy tính và lập trình
30 trang 142 0 0 -
Giáo trình nhập môn lập trình - Phần 22
48 trang 135 0 0 -
14 trang 128 0 0