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.
Hi..it is working some times fine..not all the cases..
what is oldvalue here..because i m using this old value in both the events.
where to declare that oldvalue..how to get that old value.
please give reply..
You can use EditModeEnding and EditModeEnded events:
In EditModeEnding get the old value:
void xamDataGrid1_EditModeEnding(object sender, Infragistics.Windows.DataPresenter.Events.EditModeEndingEventArgs e)
oldValue = e.Cell.Value;
}
and in EditModeEnded check if the value is greater then 100 and return to the oldValue
void xamDataGrid1_EditModeEnded(object sender, Infragistics.Windows.DataPresenter.Events.EditModeEndedEventArgs e)
if (a > 100)
e.Cell.Value = oldValue;
Hope this helps,
Alex.