Esempio n. 1
0
 protected virtual void OnSortCommand(MxDataGridSortCommandEventArgs e)
 {
     object dataSource = this.DataSource;
     this.EditItemIndex = -1;
     if (dataSource is DataControl)
     {
         if (!((DataControl) dataSource).CanSort)
         {
             return;
         }
         ((DataControl) dataSource).SetSortExpression(this.DataMember, e.SortExpression);
         this.CurrentPageIndex = 0;
     }
     MxDataGridSortCommandEventHandler handler = (MxDataGridSortCommandEventHandler) base.Events[EventSortCommand];
     if (handler != null)
     {
         handler(this, e);
     }
     if (this.AutoDataBind)
     {
         this.DataBind();
     }
 }
Esempio n. 2
0
 protected override bool OnBubbleEvent(object source, EventArgs e)
 {
     bool flag = false;
     if (e is MxDataGridCommandEventArgs)
     {
         MxDataGridCommandEventArgs args = (MxDataGridCommandEventArgs) e;
         this.OnItemCommand(args);
         flag = true;
         string commandName = args.CommandName;
         if (string.Compare(commandName, "Select", true, CultureInfo.InvariantCulture) == 0)
         {
             this.SelectedIndex = args.Item.ItemIndex;
             this.OnSelectedIndexChanged(EventArgs.Empty);
             return flag;
         }
         if (string.Compare(commandName, "Page", true, CultureInfo.InvariantCulture) == 0)
         {
             string commandArgument = (string) args.CommandArgument;
             int currentPageIndex = this.CurrentPageIndex;
             if (string.Compare(commandArgument, "Next", true, CultureInfo.InvariantCulture) == 0)
             {
                 currentPageIndex++;
             }
             else if (string.Compare(commandArgument, "Prev", true, CultureInfo.InvariantCulture) == 0)
             {
                 currentPageIndex--;
             }
             else
             {
                 currentPageIndex = int.Parse(commandArgument) - 1;
             }
             MxDataGridPageChangedEventArgs args2 = new MxDataGridPageChangedEventArgs(source, currentPageIndex);
             this.OnPageIndexChanged(args2);
             return flag;
         }
         if (string.Compare(commandName, "Sort", true, CultureInfo.InvariantCulture) == 0)
         {
             MxDataGridSortCommandEventArgs args3 = new MxDataGridSortCommandEventArgs(source, args);
             this.OnSortCommand(args3);
             return flag;
         }
         if (string.Compare(commandName, "Edit", true, CultureInfo.InvariantCulture) == 0)
         {
             this.OnEditCommand(args);
             return flag;
         }
         if (string.Compare(commandName, "Update", true, CultureInfo.InvariantCulture) == 0)
         {
             this.OnUpdateCommand(new MxDataGridUpdateEventArgs(args, false));
             return flag;
         }
         if (string.Compare(commandName, "Cancel", true, CultureInfo.InvariantCulture) == 0)
         {
             this.OnCancelCommand(args);
             return flag;
         }
         if (string.Compare(commandName, "Delete", true, CultureInfo.InvariantCulture) == 0)
         {
             this.OnDeleteCommand(new MxDataGridCancelEventArgs(args, false));
         }
     }
     return flag;
 }