开发者

nested set and treeview control

Given the following database tables and sample data:

Locations
Id  ParentId  LeftIndex  RightIndex  Description
--  --------  ---------  ----------  -----------
34  2         85         104         Florida Region
73  34        94         95          Miami

Products
Id  ParentLocationId  Code  Description
--  ----------------  ----  -----------
1   73                MIW0  Miami Magazines

I'm using a nested set for my hierarchy data. What I'm trying to do is display my locations and products together in a c开发者_开发百科ollapsible tree view control. Will I somehow have to combine the tables before proceeding? Please advise in all areas (see tags)

Thanks,

rod.


I would recommend you create a ModelView that you map your domain models into in your controller. For example, something like

public class TreeViewEntry {
    public string Name { get; set; }
    public TreeViewEntry[] Children { get; set; }
}

and then take a look at this page for a jQuery plugin and HTML helper: http://www.matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜