<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>

<!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">
<%@ register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <br />
    <br />
    <asp:ScriptManager runat="server" ID="RadScriptManager1">
    </asp:ScriptManager>
    <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
    </asp:ContentPlaceHolder>
    <script type="text/javascript">

        function pageLoad() {

        }

        function rtvExplore_OnNodeExpandedCollapsed(sender, eventArgs) {
            var allNodes = eventArgs._node.get_treeView().get_allNodes();

            var i;
            var selectedNodes = "";

            for (i = 0; i < allNodes.length; i++) {
                if (allNodes[i].get_expanded())
                    selectedNodes += allNodes[i].get_text() + "*";
            }

            Set_Cookie("expandedNodes", selectedNodes, 30);
        }



        function Set_Cookie(name, value, expires, path, domain, secure) {
            // set time, it's in milliseconds
            var today = new Date();
            today.setTime(today.getTime());

            /*
            if the expires variable is set, make the correct 
            expires time, the current script below will set 
            it for x number of days, to make it for hours, 
            delete * 24, for minutes, delete * 60 * 24
            */
            if (expires) {
                expires = expires * 1000 * 60 * 60 * 24;
            }
            var expires_date = new Date(today.getTime() + (expires));

            document.cookie = name + "=" + escape(value) +
                        ((expires) ? ";expires=" + expires_date.toGMTString() : "") +
                        ((path) ? ";path=" + path : "") +
                        ((domain) ? ";domain=" + domain : "") +
                        ((secure) ? ";secure" : "");
        }

      
    </script>
    <telerik:RadTreeView ID="RadTreeView1" runat="server" Width="100%" Height="250px"
        OnClientNodeExpanded="rtvExplore_OnNodeExpandedCollapsed" OnClientNodeCollapsed="rtvExplore_OnNodeExpandedCollapsed"
        DataFieldID="EmployeeID" DataFieldParentID="ReportsTo" DataTextField="LastName"  DataNavigateUrlField="PhotoPath"
        DataSourceID="SqlDataSource1" OnNodeDataBound="RadTreeView1_NodeDataBound">
       
    </telerik:RadTreeView>
    <asp:Button ID="Button1" runat="server" Text="Postback" />
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Northwind.mdf;Integrated Security=True;User Instance=True"
        ProviderName="System.Data.SqlClient" SelectCommand="SELECT * From Employees">
    </asp:SqlDataSource>
    </form>
</body>
</html>
