我现在做的一个项目需要用到TreeTable,由于没做递归,只能读出一个子节点,后面的节点读不到了,代码如下<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Service88.Core.Products.ProductCategory>>" %><asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">    <script src="../../Scripts/treeTable/doc/javascripts/jquery.js" type="text/javascript"></script>    <script src="../../Scripts/treeTable/doc/javascripts/jquery.ui.js" type="text/javascript"></script>    <script src="../../Scripts/treeTable/src/javascripts/jquery.treeTable.js" type="text/javascript"></script>    <link href="../../Scripts/treeTable/src/stylesheets/jquery.treeTable.css" rel="stylesheet" type="text/css" />
    
     <script type="text/javascript">         $(document).ready(function() {
             $("#dnd-example").treeTable();             // Drag & Drop Example Code
             $("#dnd-example .file, #dnd-example .folder").draggable({
                 helper: "clone",
                 opacity: .75,
                 refreshPositions: true, // Performance?
                 revert: "invalid",
                 revertDuration: 300,
                 scroll: true
             });             $("#dnd-example .folder").each(function() {
                 $($(this).parents("tr")[0]).droppable({
                     accept: ".file, .folder",
                     drop: function(e, ui) {
                         $($(ui.draggable).parents("tr")[0]).appendBranchTo(this);
                     },
                     hoverClass: "accept",
                     over: function(e, ui) {
                         if (this.id != ui.draggable.parents("tr.parent")[0].id && !$(this).is(".expanded")) {
                             $(this).expand();
                         }
                     }
                 });
             });             // Make visible that a row is clicked
             $("table#dnd-example tbody tr").mousedown(function() {
                 $("tr.selected").removeClass("selected"); // Deselect currently selected rows
                 $(this).addClass("selected");
             });             // Make sure row is selected when span is clicked
             $("table#dnd-example tbody tr span").mousedown(function() {
                 $($(this).parents("tr")[0]).trigger("mousedown");
             });
         });
  
  </script>
  
<%Html.BeginForm("SearchProduct","ProductCategory",FormMethod.Post); %>
    <table cellpadding="3" cellspacing="1" border="0" width="100%" align="center" class="searchTable">
        <tr>
            <td colspan="2" height="25" class="td_title">
                搜索
            </td>
        </tr>
        <tr>
            <td width="20%" height="23">
                搜索条件:
            </td>
            <td class="forumRow">
             分类代码:<%=Html.TextBox("categoryCode")%>
             分类名:<%=Html.TextBox ("categoryName") %>
            <input type="hidden" value="0" name="pageIndex" />
            <input type="submit" name="search" value="搜索" id="submit" class="button searchBtn" />
            </td>
        </tr>
    </table>
<%Html.EndForm(); %>
    <br />
    <table width="100%" cellpadding="3" cellspacing="1" border="0" class="listHeader">
        <tr>
            <td class="td_title" height="25">
                产品类型列表
            </td>
            <td style="text-align:right" class="td_title">
                 <%= Html.ActionLink("添加一级分类", "Add",null,new {@class="addLink"}) %>
            </td>
        </tr>
    </table>
<table id="dnd-example" cellspacing="1" cellpadding="3" rules="all" border="0" class="listTable" style="border-width:0px;width:100%; padding-left :2px;">
    <thead>
            <tr>
                <th>商品分类代码</th>
                <th>商品分类名</th>
                <th>序号</th>
                <th>操作</th>
            </tr>
        </thead>
        <%
            
            foreach (var item in Model) 
           {
               var node = "node--";
               var parent = "parent ";
               var bar = "-";
               var childOf = "child-of-";
                
               var parentIdName = node + item.Code;
               var parentClassName = parent;
                
               var childIdName = "";
               var childClassName = "";              // var noParentIdName = childIdName;
               var noChildClassName = "";
               
               string[] productCategoryParent=null;
               if(item.Parent ==null)
                {
                    productCategoryParent=item.Code.Split (',');
                    
                }
               foreach (var pcp in productCategoryParent)
                {
                    
                }
               //一级分类:无父类
               if (item.Parent == null)
               { %> 
                <tbody>
                    <tr id="<%=parentIdName %>"  class="<%=parentClassName %>">
                        <td>
                           <span class="folder"> <%= Html.Encode(item.Code)%></span>
                        </td>
                        <td>
                            <%= Html.Encode(item.Name)%>
                        </td>
                         <td>
                            <%= Html.Encode(item.Sequence)%>
                        </td>
                        
                        <td>
                            <%= Html.ActionLink("编辑", "Edit", new { CategoryId = item.ID }, new { @class = "editLink" })%> |
                            <%= Html.ActionLink("删除", "Delete", new { CategoryId = item.ID }, new { @class = "delLink" })%> |
                            <%= Html.ActionLink("添加子类", "AddChild", new { CategoryId = item.ID }, new { @class = "addLink" })%>
                        </td>
                    </tr>
                </tbody>
                
            <%}
                  //有父级分类且有子类
               if (item.Parent != null && item.Children != null) 
               {
                   childIdName = node + item.Parent .Code +bar+ item.Code;
                   childClassName = parent + childOf + node + item.Parent .Code;
                  %>
                   <tbody>
                        <tr id="<%=childIdName %>"  class="<%=childClassName%>">
                            <td>
                                <span class="folder"><%= Html.Encode(item.Code)%></span>
                                
                            </td>
                            <td>
                                <%= Html.Encode(item.Name )%>
                            </td>
                             <td>
                                <%= Html.Encode(item.Sequence)%>
                            </td>
                            <td>
                                <%= Html.ActionLink("编辑", "Edit", new { CategoryId = item.ID }, new { @class = "editLink" })%> |
                                <%= Html.ActionLink("删除", "Delete", new { CategoryId = item.ID }, new { @class = "delLink" })%> |
                                <%= Html.ActionLink("添加子类", "AddChild", new { CategoryId = item.ID }, new { @class = "addLink" })%>
                            </td>
                        </tr>
                   </tbody>
               <%}
               //有父级分类且无子类
                if(item.Parent!=null && item.Children ==null)
                {
                    childIdName = node + item.Parent.Code +bar+ item.Code;
                    noChildClassName = childOf + node + item.Parent .Code;
                    %>
                     <tbody>
                        <tr id="<%=childIdName%>"  class="<%=noChildClassName%>">
                            <td>
                                <span class="file"><%= Html.Encode(item.Code)%></span>
                              
                            </td>
                            <td>
                                <%= Html.Encode(item.Name )%>
                            </td>
                             <td>
                                <%= Html.Encode(item.Sequence)%>
                            </td>
                            <td>
                                <%= Html.ActionLink("编辑", "Edit", new { CategoryId = item.ID }, new { @class = "editLink" })%> |
                                <%= Html.ActionLink("删除", "Delete", new { CategoryId = item.ID }, new { @class = "delLink" })%> |
                                <%= Html.ActionLink("添加子类", "AddChild", new { CategoryId = item.ID }, new { @class = "addLink" })%>
                            </td>
                        </tr>
                   </tbody>
                 <%}            } %>
    </table>
  
</asp:Content>
Controller代码 public ActionResult ProductCategoryList()
        {
            Title = "产品类型列表";  
            var list = ProductCategory.GetAll().OrderBy(p=>p.Code);
            return View(list);
        }