XML data binding? : XML TreeView « XML « ASP.Net






XML data binding?


<%@ Page Language="C#"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Using XML Data Source::Simple</title>
</head>

<body>
    <div id="pageContent">
        <form id="form1" runat="server">
            <asp:xmldatasource runat="server" ID="XmlDataSource1" DataFile="Data.xml" />
            <asp:TreeView ID="TreeView1" runat="server" DataSourceID="XmlDataSource1" />
        </form>
    </div>
</body>
</html>

File: Data.xml

<?xml version="1.0" standalone="yes"?>
<MyDataSet>
  <NorthwindEmployees>
    <Employee>
      <employeeid>1</employeeid>
      <lastname>D</lastname>
      <firstname>N</firstname>
      <title>Representative</title>
    </Employee>
    <Employee>
      <employeeid>2</employeeid>
      <lastname>Fill</lastname>
      <firstname>Andrew</firstname>
      <title>President</title>
    </Employee>
    <Employee>
      <employeeid>3</employeeid>
      <lastname>Lev</lastname>
      <firstname>Janet</firstname>
      <title>Sales</title>
    </Employee>
  </NorthwindEmployees>
</MyDataSet>

 








Related examples in the same category

1.Build tree out of the XML data file
2.Bind inline XML datasource to asp treeview
3.asp:TreeView binded to XML transformation data
4.asp TreeView data binding to XML data
5.detailed XML data binding
6.TreeNode Binding