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

[Solved] Telerik Menu to display telerik Treeview in menu item

0 Answers 35 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.
Ali
Top achievements
Rank 1
Ali asked on 20 Sep 2012, 10:28 PM

 I need to render this Telerik treeview control in a telerik menu item with
menu display name: Locations. Can you tell me how I can place a Telerik Tree view
control (exact code below) into at telerik menu item with menu name : 'Locations'

I have added my code below for your reference. This code does not render the Treeview control. I have tried setting OpenOnClick true and false but still does not work.

  <li>
           <% Html.Telerik().Menu()
             .OpenOnClick(true)
           .Name("locations")            
           .Items(items => 
           {
            items.Add()
                 .Text("Locations")
                 .Content(() => 
                 { 
                 %>
                <% Html.Telerik().TreeView()
                       .Name("TreeView1")
                       .ShowCheckBox(true)
                       .BindTo(Model.SessionProvider.GetAvailableLocations, mappings =>
                    {
                        mappings.For<RegionEntity>(binding => binding
                            .ItemDataBound((item, region) =>
                                               {
                                                   item.Text = region.RecordName;
                                                   item.Value = region.ID.ToString();
                                                   //if (checkedNodes != null)
                                                   //{
                                                   //    var checkedNode = checkedNodes.Where(e => e.Value.Equals(employee.EmployeeID.ToString())).FirstOrDefault();
                                                   //    item.Checked = checkedNode != null ? checkedNode.Checked : false;
                                                   //} item.Expanded = true;
                                               }).Children(location => location.Location));
                        mappings.For<LocationEntity>(binding => binding
                                                                    .ItemDataBound((item, location) =>
                                                                                       {
                                                                                           item.Text = location.Name;
                                                                                           item.Value =
                                                                                               location.Number.ToString();
                                                                                       }));
                    }).Render();%>   
                 <% 
                 });
       })
       .Render();
%>
</li>


Tags
TreeView
Asked by
Ali
Top achievements
Rank 1
Share this question
or