Professional ASP.NET 3.5 in C# and Visual Basic Part 60

Professional in C# and Visual Basic Part 60. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 10 Working with XML and LINQ to XML text xml This code creates an XmlDocument called Customers. Then it executes the SQL command and retrieves the XML data into an XmlReader. An XPathNavigator is created from the XmlDocument and a child node is prepended to the document. A single call to the WriteNode method of the XmlWriter retrieved from the XPathDocument moves the entire XML fragment into the well-formed XmlDocument. Because the SQL statement contained from Customers as Customer as a table alias each XML element is named Customer . Then for this example the resulting XML document is output directly to the Response object. You see the resulting XML in the browser shown in Figure 10-10. Figure 10-10 Of course it s nice to see the resulting XML but it s far more useful to style that information with XSLT. The XML Web Server control mentioned earlier is perfect for this task. However in Listing 10-22 rather than setting both the TransformSource and Documentsource properties as in Listing 10-25 you set only the TransformSource property at design time and the XmlDocument is the one created in the code-behind of Listing 10-21. 547 Chapter 10 Working with XML and LINQ to XML Listing 10-22 The ASPX Page and XSLT to style the XML from SQL Server ASPX @ Page Language C CodeFile Inherits Default_aspx asp xml id Xml1 runat server transformsource XSLT xml version encoding utf-8 xsl stylesheet xmlns xsl http 1999 XSL Transform version xsl output method html xsl template match h3 List of Customers h3 table border 1 tr th Company Name th th Contact Name th th Contact Title th tr xsl apply-templates select Customer table xsl template xsl template match Customer tr td xsl value-of select CompanyName td td xsl value-of select ContactName td td xsl value-of select ContactTitle td tr xsl template xsl stylesheet VB text xml .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.