Posted 6 February 2024, 8:03 pm EST
Good morning,
I have a grid and when I leave the cell after the change, I set the text as Red and I enable a save button.
Now I disable the cell where the content is Primary Key (PK) on the table of DB.
So I update all the cells except PK.
I need your help to allow the final user to edit PK to.
So I have to save previous PK. to make
UPDATE table_name set Pk_col = ‘NEW_VALUE’ where PK_col = ‘OLD_VALUE’
There is a way in _CellChanged event to capture the OLD_VALUE?
Thanks Alex
This is my portion of code where (i think) i have to capture the OLD_VALUE.
private void _fgTable_CellChanged(object sender, RowColEventArgs e)
{
try
{
if (_isLoading) return;
CellStyle s = _fgTable.Styles.Add(“IsChanged”);
s.ForeColor = Color.Red;
CellRange rg = _fgTable.GetCellRange(e.Row, e.Col);
rg.Style = _fgTable.Styles[“IsChanged”];
enableButtons(true);
_modifyInProgress = true;
}
catch (Exception ex)
{
ctrlLogger.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); ctrlLogger.Error(ex.Message + "\n" + ex.StackTrace); if (ex.InnerException != null) ctrlLogger.Error("Inner Exception: " + ex.InnerException.Message); }
}