Example #1
0
        private void InitializeDataSource()
        {
            // check the current entity if viewing on an entity page
            int id = ID_NOT_DEFINED;

            if (HasDefinedInQueryString(out id) ||
                HasDefinedInProfile(out id))
            {
                ProductMappingLinkItem selectedEntity = ProductMappingLinkItem.Find(id, this.EntityType);
                if (selectedEntity != null)
                {
                    selectedEntity.LoadChildren();
                    this.DataSource = LinkItemCollection.BuildFrom(selectedEntity, selectedEntity.Type);
                    return;
                }
            }

            // by default load the root level entities
            this.DataSource = LinkItemCollection.GetAllFirstLevel(this.EntityType, this.MaxMenuSize, Customer.Current.LocaleSetting);
        }