Пример #1
0
 protected virtual void OnSelectedIndexChanging(TabsChangingEventArgs e)
 {
     TabsChangingEventHandler eventHandler = (TabsChangingEventHandler)Events[EventSelectedIndexChanging];
     if (eventHandler != null)
     {
         this.SelectedIndex = e.OldIndex;
         eventHandler(this, e);
         if (!e.Cancel)
         {
             this.OnSelectedIndexChanged(new TabsChangedEventArgs(e.NewIndex, e.OldIndex, this.SelectedTab, this));
         }
     }
 }
Пример #2
0
        public void RaisePostBackEvent(string eventArgument)
        {
            if (eventArgument != null)
            {
                //selecting event
                if (eventArgument.StartsWith("selectedindexchanging"))
                {
                    string[] values = eventArgument.Split(':');

                    int newIndex = Convert.ToInt32(values[1]);
                    int oldIndex = Convert.ToInt32(values[2]);

                    TabsChangingEventArgs args = new TabsChangingEventArgs(newIndex, oldIndex, this.SelectedTab, this);
                    this.OnSelectedIndexChanging(args);
                }
                //selected event
                if (eventArgument.StartsWith("selectedindexchanged"))
                {
                    string[] values = eventArgument.Split(':');

                    int index = Convert.ToInt32(values[1]);
                    int oldIndex = Convert.ToInt32(values[2]);

                    TabsChangedEventArgs args = new TabsChangedEventArgs(index, oldIndex, this.SelectedTab, this);
                    this.OnSelectedIndexChanged(args);
                }
                //removing event
                if (eventArgument.StartsWith("tabremoving"))
                {
                    string[] values = eventArgument.Split(':');
                    int tabIndex = Convert.ToInt32(values[1]);

                    TabsRemovingEventArgs args = new TabsRemovingEventArgs(tabIndex, this.Tabs[tabIndex], this);
                    this.OnTabRemoving(args);
                }
                //removed event
                if (eventArgument.StartsWith("tabremoved"))
                {
                    string[] values = eventArgument.Split(':');
                    int tabIndex = Convert.ToInt32(values[1]);
                    TabsRemovedEventArgs args = new TabsRemovedEventArgs(tabIndex, this.Tabs[tabIndex], this);
                    this.OnTabRemoved(args);
                }
                //moved event
                if (eventArgument.StartsWith("tabmoved"))
                {
                    string[] values = eventArgument.Split(':');

                    int oldPosition = Convert.ToInt32(values[1]);
                    int newPosition = Convert.ToInt32(values[2]);

                    ReorderTabItems(oldPosition, newPosition);

                    this.OnTabMoved(new EventArgs());
                }
            }
        }