Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
380
How to Capture Field Old value when we modify the field
posted

Hi..i m using xamgrid..Here i want the old value of the cel when i edit with new value.

i wrote the code in cell_Editending event..

but that old value is only repeating to every cell.

means if i edit one cell i can capture tat old value.if i edit another cel means it is capturing previously edited cell old value not this cell old value.

bec here i declared oldvalue variable globally....

 

 

private

void MainDataGrid_CellUpdating(object sender, Infragistics.Windows.DataPresenter.Events.CellUpdatingEventArgs e){

 

 

int a;

 

 

if (int.TryParse(e.Cell.Value.ToString(), out a)

private void MainDataGrid_CellUpdated(object sender, Infragistics.Windows.DataPresenter.Events.CellUpdatedEventArgs e)

if (int.TryParse(e.Cell.Value.ToString(), out a)){

 

if (a > 100){MessageBox.Show("Sorry U Cant Enter More Than 100!!");

e.Cell.Value = oldvalue;

}}}

 

please see this code once..any error is there..bec it is not capturing edited cel previous value..

it is capturing before edited cell value.

 

int a;

 

int a;

 

if (int.TryParse(e.Cell.Value.ToString(), out a)){

 

if (a > 100){MessageBox.Show("Sorry U Cant Enter More Than 100!!");

e.Cell.Value = oldvalue;

}}}

 

please see this code once..any error is there..bec it is not capturing edited cel previous value..

it is capturing before edited cell value.