protected override void OnSelectionChanged()
            {
                base.OnSelectionChanged();

                TabbedMultiView multiView = ((TabbedMultiView)OwnerControl);
                TabView         view      = null;

                //  Cannot use FindControl without a Naming Container. Only during initialization phase of aspx.
                if (multiView.NamingContainer != null)
                {
                    bool isPlaceHolderTab = _target == null;
                    if (isPlaceHolderTab)
                    {
                        view = multiView._placeHolderTabView;
                    }
                    else
                    {
                        view = (TabView)multiView.MultiViewInternal.FindControl(_target);
                    }
                }
                else
                {
                    foreach (TabView tabView in multiView.MultiViewInternal.Controls)
                    {
                        if (tabView.ID == _target)
                        {
                            view = tabView;
                            break;
                        }
                    }
                }
                multiView.SetActiveView(view);
            }
        private void OnTabViewRemove(TabView view)
        {
            EnsureChildControls();

            TabView activeView = GetActiveView();

            if (view != null && view == activeView)
            {
                int  index     = MultiViewInternal.Controls.IndexOf(view);
                bool isLastTab = index == MultiViewInternal.Controls.Count - 1;
                if (isLastTab)
                {
                    if (MultiViewInternal.Controls.Count > 1)
                    {
                        _newActiveTabAfterRemove = (TabView)MultiViewInternal.Controls[index - 1];
                    }
                    else // No Tabs left after this tab
                    {
                        _newActiveTabAfterRemove = _placeHolderTabView;
                    }
                }
                else
                {
                    _newActiveTabAfterRemove = (TabView)MultiViewInternal.Controls[index + 1];
                }
            }
            else
            {
                _newActiveTabAfterRemove = null;
            }
        }
        public override void AddAt(int index, Control control)
        {
            TabView view = ArgumentUtility.CheckNotNullAndType <TabView> ("control", control);

            base.AddAt(index, view);
            Owner.OnTabViewInserted(view);
        }
        public override void Remove(Control control)
        {
            TabView view = ArgumentUtility.CheckNotNullAndType <TabView> ("control", control);

            Owner.OnTabViewRemove(view);
            base.Remove(control);
            Owner.OnTabViewRemoved(view);
        }
        public void SetActiveView(TabView view)
        {
            ArgumentUtility.CheckNotNull("view", view);
            MultiViewInternal.SetActiveView(view);
            TabView activeView    = GetActiveView();
            WebTab  nextActiveTab = _tabStrip.Tabs.Find(activeView.ID + c_itemIDSuffix);

            nextActiveTab.IsSelected = true;
        }
        public TabView GetActiveView()
        {
            TabView view = (TabView)MultiViewInternal.GetActiveView();

            if (view != null && _isInitialized)
            {
                view.EnsureLazyControls();
            }
            return(view);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            TabView view = (TabView)MultiViewInternal.GetActiveView();

            if (view != null)
            {
                view.EnsureLazyControls();
            }
        }
            protected override void AddedControl(Control control, int index)
            {
                TabView tabView = ArgumentUtility.CheckNotNullAndType <TabView> ("control", control);

                tabView.IsLazyLoadingEnabled = Parent.EnableLazyLoading;
                if (!Parent.EnableLazyLoading)
                {
                    tabView.EnsureLazyControls();
                }

                base.AddedControl(control, index);
            }
        public override void RemoveAt(int index)
        {
            if (index < 0 || index > this.Count)
            {
                throw new ArgumentOutOfRangeException("index");
            }
            TabView view = (TabView)this[index];

            Owner.OnTabViewRemove(view);
            base.RemoveAt(index);
            Owner.OnTabViewRemoved(view);
        }
Пример #10
0
        private void OnTabViewInserted(TabView view)
        {
            EnsureChildControls();

            MultiViewTab tab = new MultiViewTab();

            tab.ItemID = view.ID + c_itemIDSuffix;
            tab.Text   = view.Title;
            tab.Icon   = view.Icon;
            tab.Target = view.ID;
            _tabStrip.Tabs.Add(tab);

            if (Views.Count == 2 && Views.IndexOf(_placeHolderTabView) > 0)
            {
                Views.Remove(_placeHolderTabView);
            }

            if (Views.Count == 1)
            {
                _multiViewInternal.ActiveViewIndex = 0;
            }
        }
Пример #11
0
        private void OnTabViewRemoved(TabView view)
        {
            EnsureChildControls();

            WebTab tab = _tabStrip.Tabs.Find(view.ID + c_itemIDSuffix);

            if (tab == null)
            {
                return;
            }

            int tabIndex = _tabStrip.Tabs.IndexOf(tab);

            _tabStrip.Tabs.RemoveAt(tabIndex);

            if (_newActiveTabAfterRemove != null)
            {
                if (_newActiveTabAfterRemove == _placeHolderTabView)
                {
                    Views.Add(_placeHolderTabView);
                }
                SetActiveView(_newActiveTabAfterRemove);
            }
        }
Пример #12
0
 internal void OnTabViewRemoved(TabView view)
 {
     Parent.OnTabViewRemoved(view);
 }
Пример #13
0
 internal void OnTabViewInserted(TabView view)
 {
     Parent.OnTabViewInserted(view);
 }