public void AddRow(DevExpress.XtraGrid.Views.Grid.GridView View) { int currentRow; currentRow = View.FocusedRowHandle; if (currentRow < 0) { currentRow = View.GetDataRowHandleByGroupRowHandle(currentRow); } if (View.GroupedColumns.Count == 0) { return; } string grp = View.GetRowCellValue(currentRow, colGRP).ToString(); GenelDataSet.XGTRow xgtRow = this.genelDataSet.XGT.FindByGRPID(grp, "+"); if (xgtRow.SYS == "M" || xgtRow.SYS == "V") // Grup Modify ise eklenebilir { View.AddNewRow(); View.SetRowCellValue(View.FocusedRowHandle, colGRP, grp); View.SetRowCellValue(View.FocusedRowHandle, colID, ""); View.SetRowCellValue(View.FocusedRowHandle, colSYS, "V"); // User Modify View.UpdateCurrentRow(); View.MakeRowVisible(View.FocusedRowHandle, true); View.ShowEditor(); } }
protected virtual void GridControl_ProcessGridKey(object sender, KeyEventArgs e) { DevExpress.XtraGrid.GridControl gridctrl = sender as DevExpress.XtraGrid.GridControl; DevExpress.XtraGrid.Views.Grid.GridView gridView = (DevExpress.XtraGrid.Views.Grid.GridView) this.DefaultView; if (e.KeyCode == Keys.Tab || e.KeyCode == Keys.Enter) { if (gridView.FocusedRowHandle == DevExpress.XtraGrid.GridControl.NewItemRowHandle) { gridView.AddNewRow(); } gridView.FocusedRowHandle = DevExpress.XtraGrid.GridControl.NewItemRowHandle; gridView.FocusedColumn = gridView.VisibleColumns[0]; gridView.ShowEditor(); } }
public void loadbangkehangtheongay(string ngaychungtu, string ngaycuoi, string manhanvien, DevExpress.XtraGrid.Views.Grid.GridView gridView1) { while (gridView1.RowCount > 1) { gridView1.DeleteRow(0); } manhanvien = gen.GetString("select AccountingObjectID from AccountingObject where AccountingObjectCode='" + manhanvien + "'"); DataTable temp = gen.GetTable("select '131','1111',AccountingObjectCode,SUM(TotalAmountOC+TotalAmount-(TotalFreightAmount/(1+Cast(Tax as money)/100))) as tien from INOutward a, AccountingObject b where a.AccountingObjectID=b.AccountingObjectID and RefDate>='" + ngaychungtu + "' and RefDate<='" + ngaycuoi + "' and EmployeeIDSA='" + manhanvien + "' and IsExport=1 group by AccountingObjectCode order by AccountingObjectCode"); for (int i = 0; i < temp.Rows.Count; i++) { gridView1.AddNewRow(); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["Tài khoản có"], temp.Rows[i][0].ToString()); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["Tài khoản nợ"], temp.Rows[i][1].ToString()); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["Số tiền"], Double.Parse(temp.Rows[i][3].ToString())); gridView1.SetRowCellValue(gridView1.FocusedRowHandle, gridView1.Columns["Mã khách"], temp.Rows[i][2].ToString()); gridView1.UpdateCurrentRow(); } }