This is a migrated thread and some comments may be shown as answers.

[Solved] Tree view data binding with hierarchical data using templates

1 Answer 107 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
T
Top achievements
Rank 1
T asked on 05 May 2011, 07:07 PM
hello, i cannot get my tree to display the children of each item (and their children, etc).

I got my template to work by using INlineTemplate, but doing that now causes my tree to no longer show the full hierarchy....again, if i remove thecurrentItem.Template.InlineTemplate, the whole tree is shown correctly.

The ChildTaxonomyNodes collection is the same type as the parent, so i dont think i need any more mappings

What am i doing wrong?

thanks
TS
@(
    Html.Telerik().TreeView()
        .Name(Model.TreeName)
        .BindTo(Model.DataSource, mappings =>
        {
            mappings.For<Dell.Commerce.Web.ClientApi.SystemCatalog.TaxonomyNodeItem>(binding => binding
                    .ItemDataBound((currentItem, navigationItem) =>
                    {
                        currentItem.Text = navigationItem.DisplayName;
                        currentItem.Value = navigationItem.Id.ToString();
                        currentItem.Expanded = true;
                        //currentItem.Content = () => { Html.TextBoxFor(y => y.DisplayName, new { Style = "display:none;" }); };
                        currentItem.Template.InlineTemplate =
                        @<text>
                            @Html.TextBoxFor(y => y.DisplayName, new { Style = "display:block;" })
                        </text>;
                    })
                    .Children(nodeItem => nodeItem.ChildTaxonomyNodes));
        })
        .ExpandAll(true)
        .DragAndDrop(true)
)

1 Answer, 1 is accepted

Sort by
0
baba
Top achievements
Rank 1
answered on 18 Jun 2011, 12:32 AM
Hi,

 I have the same issue. Do anyone know where is the problem?

Thanks
Tags
TreeView
Asked by
T
Top achievements
Rank 1
Answers by
baba
Top achievements
Rank 1
Share this question
or