Ejemplo n.º 1
0
 void btn_MoveFirst_Click(object sender, EventArgs e)
 {
     HandCallInit(Customer_BeforeMoveFirst, Customer_AfterMoveFirst,
                  new EventHandler(delegate
     {
         DataTableMoveTools.DataRowMoveFirst(View.GetFocusedDataRow());
         View.MoveFirst();
     }));
 }
        private void gc_DataDetail_EmbeddedNavigator_ButtonClick(object sender, DevExpress.XtraEditors.NavigatorButtonClickEventArgs e)
        {
            int handle = gv_DataDetail.FocusedRowHandle;

            if (e.Button.ButtonType == NavigatorButtonType.First)
            {
                DataTableMoveTools.DataRowMoveFirst(gv_DataDetail.GetFocusedDataRow());
                gv_DataDetail.MoveFirst();
                UpdateIndex();
                e.Handled = true;
            }
            else if (e.Button.ButtonType == NavigatorButtonType.Last)
            {
                DataTableMoveTools.DataRowMoveLast(gv_DataDetail.GetFocusedDataRow());
                gv_DataDetail.MoveLast();
                UpdateIndex();
                e.Handled = true;
            }
            else if (e.Button.ButtonType == NavigatorButtonType.Prev)
            {
                DataTableMoveTools.DataRowMovePrev(gv_DataDetail.GetFocusedDataRow());
                gv_DataDetail.FocusedRowHandle = handle - 1;
                UpdateIndex();
                e.Handled = true;
            }
            else if (e.Button.ButtonType == NavigatorButtonType.Next)
            {
                DataTableMoveTools.DataRowMoveNext(gv_DataDetail.GetFocusedDataRow());
                gv_DataDetail.FocusedRowHandle = handle + 1;
                UpdateIndex();
                e.Handled = true;
            }
            else if (e.Button.ButtonType == NavigatorButtonType.Append)
            {
                DataTable dt = gc_DataDetail.DataSource as DataTable;
                DataRow   dr = dt.Rows.Add();
                dr[dt_CommonDicData.DataType] = gv_DataType.GetFocusedRowCellValue("Name");
                UpdateIndex();
                e.Handled = true;
            }
            else if (e.Button.ButtonType == NavigatorButtonType.Remove)
            {
                if (Msg.AskQuestion("确定要删除选中的记录吗?") == false)
                {
                    e.Handled = true;
                }
            }
        }