<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="MvcApplication1.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	PanelBar
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<%--    <%
        var list = new List<string> { "fisrt", "second", "last" };        
        Html.Telerik().PanelBar().Name("PanelBar1")
            .BindTo(list, (item, stringName) => 
            {
                item.Text = stringName;
                item.Content = () => 
                {
                    %>
                        <label for="chk">
                        <%= stringName %>
                        </label>
                        <input type="checkbox" name="chkBox" id="chk" />
                    <%
                };
            })
            .Render();         
%>

<br />
<br />

<%      
    Html.Telerik().PanelBar()
                  .Name("PanelBar2")
                  .Items(p =>
                    {
                        Action<string> renderItem = (s) => {
                            p.Add().Text(s)
                                .Content(() => {
                                       %> <label for="chk2">
                                       <%= s %>
                                       </label><input type="checkbox" name="chkBox2" id="chk2" />
                                       <%
                                });
                            
                        };
                        foreach (var listItem in list)
                        {
                            renderItem(listItem);
                        }
                    })
                  .Render();
     %>
    <br />--%>
  <%= Html.Telerik().PanelBar()
     .Name("PanelBar3")
     .ExpandMode(PanelBarExpandMode.Single)
     .BindTo(Repository.repository.GetCustomersList(), mapping => mapping 
         .For<Customer>(binding => binding
            .Children(c => c.Orders)
            .ItemDataBound((item, c) => item.Text = c.Name))
         .For<Order>(binding => binding
            .Children(o => o.CustomOrders)
            .ItemDataBound((item, o) => item.Text = o.Name))
         .For<CustomOrder>(binding => binding
            .Children(o => null)
            .ItemDataBound((item, o) => item.Text = o.CustomName)
         )
       )         
     %>  
    <br />
     <%= Html.Telerik().Menu()
             .Orientation(MenuOrientation.Horizontal)
             .Name("Test")
              .BindTo(Repository.repository.GetCustomersList(), (navFactory) =>
              {
                  navFactory
                      .For<Customer>(binding =>
                      {
                          binding.Children(c => c.Orders).ItemDataBound((item, c) => item.Text = c.Name);
                      })
                      .For<Order>(binding =>
                      {
                          binding.Children(o => o.CustomOrders).ItemDataBound((item, o) => item.Text = o.Name);
                      })
                      .For<CustomOrder>(binding =>
                      {
                          binding.Children(o => null).ItemDataBound((item, o) => item.Text = o.CustomName);
                      });
              })
     %>
</asp:Content>
