<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadGridNestedViewTemplate.aspx.cs"
    Inherits="RadGridNestedViewTemplate" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function OnHierarchyExpanding(sender, eventArgs) {

            var nestedViewItem = eventArgs.get_nestedViewItem();
            var thumbnails = $telerik.findControl(nestedViewItem, "RadPanelBar1");
            var panelItem = thumbnails.findItemByText("Root Item 1");
            panelItem.expand();

        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" OnNeedDataSource="RadGrid1_NeedDataSource">
        <MasterTableView DataKeyNames="CustomerID" HierarchyLoadMode="Client">
            <NestedViewTemplate>
                <telerik:RadPanelBar ID="RadPanelBar1" runat="server" Skin="Office2007">
                    <Items>
                        <telerik:RadPanelItem Text="Root Item 1" runat="server">
                            <Items>
                                <telerik:RadPanelItem Text="Child Item 1.1" runat="server">
                                </telerik:RadPanelItem>
                                <telerik:RadPanelItem Text="Child Item 1.2" runat="server">
                                </telerik:RadPanelItem>
                            </Items>
                        </telerik:RadPanelItem>
                        <telerik:RadPanelItem runat="server" Text="Root Item 2">
                            <Items>
                                <telerik:RadPanelItem runat="server" Text="Child Item 2.1">
                                    <Items>
                                        <telerik:RadPanelItem runat="server" Text="Child Item 2.1.1">
                                        </telerik:RadPanelItem>
                                    </Items>
                                </telerik:RadPanelItem>
                                <telerik:RadPanelItem runat="server" Text="Child Item 2.2">
                                </telerik:RadPanelItem>
                            </Items>
                        </telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelBar>
            </NestedViewTemplate>
        </MasterTableView>
        <ClientSettings>
            <ClientEvents OnHierarchyExpanding="OnHierarchyExpanding" />
        </ClientSettings>
    </telerik:RadGrid>
    </form>
</body>
</html>
