This project is read-only.

This fluent MVC TreeView helper makes it easy to build and customize an HTML unordered-list tree from a recursive model.

Blog Updates

For updates and other topics please visit my blog at http://www.matthidinger.com or follow me @matthidinger

View The Full Blog Post


@model List<MvcTreeView.Models.Location>

@(Html.TreeView(Model)
    .EmptyContent("No locations have been defined yet!")    
    .Children(m => m.ChildLocations)
    .HtmlAttributes(new { id = "tree"})
    .ChildrenHtmlAttributes(new { @class = "subItem"})
    .ItemText(m => m.Name)
    .ItemTemplate(
        @<text>
            <a href="#@item.Id">@item.Name</a>
        </text>)
)

Last edited Nov 27, 2011 at 7:39 PM by mhidinger, version 2