Exemplo n.º 1
0
        protected void treeProductGroup_TreeNodePopulate(object sender, TreeNodeEventArgs e)
        {
            // http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/navigation/treeview.aspx
            TreeNode parent = e.Node;
            int      ProductGroupId;

            ProductGroupId = Convert.ToInt32(parent.Value.Substring(1));

            Controller = new BBStoreController();
            DataTable selectedProductGroups  = Controller.GetProductsInGroupByProduct(ProductId);
            List <ProductGroupInfo> products = Controller.GetProductSubGroupsByNode(PortalId, CurrentLanguage, ProductGroupId, false, false, true);

            foreach (ProductGroupInfo p in products)
            {
                TreeNode  newNode = new TreeNode(p.ProductGroupName, "_" + p.ProductGroupId.ToString());
                DataRow[] zosn    = selectedProductGroups.Select("ProductgroupId = " + p.ProductGroupId.ToString());
                if (zosn.Length > 0)
                {
                    newNode.Checked = true;
                }
                newNode.SelectAction     = TreeNodeSelectAction.Expand;
                newNode.PopulateOnDemand = true;
                //newNode.ImageUrl = FileNameToImgSrc(p.Icon);

                parent.ChildNodes.Add(newNode);
            }
        }