GeekArticles
Database
SQL ServerWorking with XML Data Using LINQ, a TreeView, and a ListView :: Displaying Data
Author: aspnet.4guysfromrolla.com |
Published: 23rd Apr 2008 |
Visited: 96 times |
Add CommentFiled in: SQL Server
With more and more data being stored in XML, web applications today commonly need some way to view and edit the data stored in an XML file from a web
page interface. If the XML data is relatively "flat" and tabular in nature, we can use data Web controls like the DataGrid, GridView, and Repeater. (See Quickly
Editing XML Data for an example of editing XML data through a DataGrid control.) But what if the XML data is more hierarchical and in a less tabular
format? Consider a company-wide phone book, which is recursively structured into branches and departments, subdepartments, and so forth. How can this XML
data, which can have any number of nodes and any level of children, be displayed and edited through a web page?
In this article we will build a web page that displays the contents of a company-wide phone book whose information is encoded in an XML file. The page
will recursively display the phone book XML data using a TreeView to list the branches and departments and a ListView to enumerate the employees that
belong to the selected branch or department. In particular, the ListView will display the employees that belong to the selected branch or department
as well as all the employees that belong to any subdepartments. (In a future article we will look at how to extend the ListView to enable the user
to add, edit, and delete phone book entries.)
Read on to learn more!
Read More >
Read Article Sponsored Links
Related Articles
• Swing Extreme Testing - The Data Validation Test The Data Validation Test
The Ok button of the SaveAsDialog should only be enabled if the name that has been entered is valid. A name can be invalid if it contains an illegal character, or if it has already been use ...
• Retrieving XML Data Retrieving XML DataTo retrieve XML data from an XMLType table, you can use a SELECT SQL statement, just as you would if you had to query a relational table. For example, to select the employee with the id set to 100 from the employees XMLType table discussed in the preceding section, you might issue ...
• Querying Data with Oracle XQuery Querying Data with Oracle XQuery
Starting with Oracle Database 10g Release 2, you can take advantage of a full-featured native XQuery engine integrated with the database. With Oracle XQuery, you can accomplish various tasks involved in developing PHP/Oracle XML applications, operating on any kind of ...
• Breaking up XML into Relational Data Breaking up XML into Relational Data
While the preceding example shows how to construct an XML representation over relational data, the example in this section illustrates how you can shred XML data back into relational data. This reverse operation can be useful if your application works with relati ...
• Accessing and Updating Data in ASP.NET 2.0: Using Optimistic Concurrency
Because multiple users can visit the same web page concurrently, it is possible for a user visiting a data modification page to inadvertently overwrite
the modifications made by another user. Consider a page with an editable GridView. If two users visit this page simultaneously from different compu ...