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

[Solved] InLineTemplate with self referencing hierarchical data

1 Answer 41 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.
Tunc Beyhan
Top achievements
Rank 1
Tunc Beyhan asked on 10 Jan 2012, 04:43 PM
Hi,
Is there any way to use InLineTemplate with self referencing data. when i use InLineTemplate i can only see root levels
Any ideas,


@(Html.Telerik().TreeView()
    .Name("LokasyonTree").BindTo((System.Collections.IEnumerable)Model, map =>
    {
        map.For<LokasyonTreeView>(binding => binding.ItemDataBound((currentItem, data) =>
        {
  
            currentItem.Text = data.Ack + (data.IsDisabled ? " [ disabled ]" : "");
            currentItem.Value = data.LokasyonId.ToString();
  
            //currentItem.Template.InlineTemplate = @<text>@Html.ActionLink("Edit", "Edit", "Location", new { id = data.LokasyonId }, null)</text>;
  
        }).Children(data => data.Childs));
    }) 
)

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 12 Jan 2012, 01:22 PM
Hello Tunc,

To avoid overwriting the template (which will cause children elements not to be rendered) I suggest you to use the Action method of the TreeViewItem instead.
In your case it would look like this:
currentItem.Action("Edit", "Location", new { id = data.LokasyonId });



Greetings,
Petur Subev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
TreeView
Asked by
Tunc Beyhan
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or