TreeView绑定XmlDataSource

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <movies>
  3. <category id="category1" text="Action">
  4. <movie id="movie1" text="Star Wars" />
  5. <movie id="movie2" text="Independence Day"/>
  6. </category>
  7. <category id="category2" text="Horror">
  8. <movie id="movie3" text="Jaws"/>
  9. <movie id="movie4" text="Nightmare Before Christmas"/>
  10. </category>
  11. </movies>
  1. <%@ Page Language="C#" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <script runat="server">
  4. </script>
  5. <html xmlns="http://www.w3.org/1999/xhtml">
  6. <head runat="server">
  7. <title></title>
  8. </head>
  9. <body>
  10. <form id="form1" runat="server">
  11. <div>
  12. <asp:TreeView ID="TreeView1" runat="server" DataSourceID="srcMovies">
  13. <DataBindings>
  14. <asp:TreeNodeBinding DataMember="category" TextField="text" ValueField="id" />
  15. <asp:TreeNodeBinding DataMember="movie" TextField="text" ValueField="id" />
  16. </DataBindings>
  17. </asp:TreeView>
  18. </div>
  19. <asp:XmlDataSource ID="srcMovies" runat="server" DataFile="~/MoviesComplex.xml">
  20. </asp:XmlDataSource>
  21. </form>
  22. </body>
  23. </html>

TreeView绑定XmlDataSource

时间: 2024-10-03 09:47:15

TreeView绑定XmlDataSource的相关文章

WPF TreeView绑定字典集合

1 <TreeView Name="Tree" HorizontalAlignment="Left" Height="269" Width="292" > 2 3 <TreeView.ItemTemplate> 4 <HierarchicalDataTemplate ItemsSource="{Binding Value}"> 5 <StackPanel> 6

WPF TreeView绑定xaml的写法(转)

WPF TreeView绑定xaml的写法 2018年05月30日 10:16:27 dxm809 阅读数:441 方法一 <Window x:Class="TreeViewDemo.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"        xmlns:x="http://schemas.microsoft.com/winfx/2006/x

WPF之TreeView绑定

新建解决方案: StudentBll.cs代码: 1 public class StudentBll 2 { 3 public List<TreeItem> infoList { get; set; } 4 public StudentBll() 5 { 6 infoList = new List<TreeItem>(); 7 infoList.Add(new TreeItem() { Self=new StudentInfo(0, "人员信息", "

winform treeview绑定数据 DOM操作

form1 public void treeView() { // datatable 定义变量接收 传归来的值 DataTable Father = new BuMenDA().ConSql(); //查询出来的的结果不可能为空 for循环一条条查出来 for (int a = 0; a <= Father.Rows.Count; a++) {// 定义新的节点接a行的 Name列 TreeNode fatherNode = new TreeNode(Father.Rows[a]["Na

WPF:TreeView绑定

namespace PostViewer { using System.Collections.ObjectModel; using System.ComponentModel; /// <summary> /// 数据类型ViewModel. /// </summary> public class VmTviDataType : ITreeItem { private bool mIsExpanded = true; private bool mIsSelected; /// &

C# treeview绑定

protected void Page_Load(object sender, EventArgs e)        {            if (!IsPostBack)            {                bindTree();            }        }        private void bindTree()        {            ALIYUN_PIC.BLL.Folder_oper_BLL bll = new Folder

C# treeview 绑定数据 【转】

private void bindTreeView1() { string sql = "select * from dm_category"; DataTable dt = db.ExecuteDataTable(sql, CommandType.Text, null); DataRow[] dr = dt.Select("parent_id is null"); for (int i = 0; i < dr.Length; i++) { TreeNode

wpf企业应用之带选项框的TreeView

wpf里面实现层次绑定主要使用HierarchicalDataTemplate,这里主要谈一谈带checkbox的treeview,具体效果见 wpf企业级开发中的几种常见业务场景. 先来看一下我的控件绑定,我这里实现的是模块权限的编辑.具体效果就是选中一个节点,后代节点.祖代节点状态都会发生相应变化,具体变化逻辑大家都懂的,描述起来很罗嗦. <TreeView Name="TreeView_Right" ItemsSource="{Binding ModuleRigh

重写TreeView模板来实现数据分层展示(一)

总想花些时间来好好总结一下TreeView这个WPF控件,今天来通过下面的这几个例子来好好总结一下这个控件,首先来看看一个常规的带虚线的TreeView控件吧,在介绍具体如何完成之前首先来看看最终实现的效果图吧! 然后我们来具体分析一下这个是怎样去实现的? 1 修改TreeView的模板层 其实TreeView中最重要的就是TreeViewItem项,这个决定了最终TreeView的展现方式,另外就是TreeView每展开子项时前面的ToggleButton的样式了,因为默认的TreeView样