private void grdReminder_ClipboardOperating(object sender, ClipboardOperationEventArgs e) { if (e.ClipboardOperation != ClipboardOperation.Paste) { return; } if (grdReminder.SelectedCells.Any(x => x.Name != CellName(nameof(Web.Models.ReminderSummary.DestinationCode)))) { e.Handled = true; return; } var copyCode = string.Empty; int code; if (Clipboard.ContainsText()) { copyCode = Clipboard.GetText(); } if (!int.TryParse(copyCode, out code)) { return; } foreach (var cell in grdReminder.SelectedCells) { cell.Value = code.ToString().PadLeft(2, '0'); } e.Handled = true; }
private void grid_ClipboardOperating(object sender, ClipboardOperationEventArgs e) { if (e.ClipboardOperation != ClipboardOperation.Paste) { return; } if (grid.SelectedCells.Any(x => x.Name != "celModifiedDueAt")) { e.Handled = true; return; } var copyDate = string.Empty; DateTime date; if (Clipboard.ContainsText()) { copyDate = Clipboard.GetText(); } if (!DateTime.TryParse(copyDate, out date)) { return; } foreach (var cell in grid.SelectedCells) { cell.Value = date; SetModifiedRow(cell.RowIndex); } e.Handled = true; SetFunctionKeysEnabled(); }