Select(new DataSourceSelectArguments());
dv.Table.TableName = "Books";
DataSet ds = dv.Table.DataSet;
ds.DataSetName = "ApressBooks";
The code from the first version of this book uses now obsolete methods for ASP.NET 2.0.
This code no longer uses the XslTransform class or obsolete properties on the XML control.
Instead, the DocumentContent and TransformSource properties are set in the code-behind class:
Xml1.DocumentSource = ds.GetXml();
Xml1.TransformSource = "ApressBooks.xslt";
These changes in the ASP.NET 2.0 object model simplify the code required. Figure 1-15
shows the output from this XML and XSLT demonstration.
34 CHAPTER 1 ?– SERVER CONTROL BASICS
Figure 1-15. Output from the XML control Web Form
Although the XML control seems to be a great way to build UIs, we do not recommend the
XSLT technique as a way to take advantage of ASP.NET and its server control mechanism for
several reasons:
??? All UI layout information must be specified declaratively inside the XSLT document, which
requires the programmer to take over the task of rendering the entire HTML document.
??? It is not possible to leverage server controls, which have the capability to render conditional
UI based on browser capabilities in this model, nor is it possible to capture events
during postback on the server side that are connected to the HTML tags rendered by
the XSLT.
Pages:
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86