StrataFrame Forum

has field value changed... ?

http://forum.strataframe.net/Topic22261.aspx

By Philipp Guntermann - 3/9/2009

hi, i am overriding the onbeforesave event on a bo and i need to check that if in editing-mode, wether a value of a specific field was changed by the user or not. like:


protected override void OnBeforeSave(MicroFour.StrataFrame.Data.BeforeSaveUndoEventArgs e)
{
    if (this.EditingState == BusinessEditingState.Adding)
    {
         if (this.custno.hasChanged)
         {
              // do something
         }
         else
         {
              // do something else
         }  
    }
    base.OnBeforeSave(e);
}

any ideas ? thanks.

By Philipp Guntermann - 3/9/2009

should read BusinessEditingState.Editing instead of BusinessEditingState.Adding
By Trent L. Taylor - 3/9/2009

Well, you could do several things.  I would not use the editing state since this is not always going to reflect a data change.  I would use the IsDirty property or the state of the current row.

If MyBo.IsDirty Then

or

If MyBo.CurrentRow.RowState = DataRowState.Modified Then
By Philipp Guntermann - 3/9/2009

hi,

ok, i can use isdirty instead of editingstate.editing, but that still wouldnt tell me wether the specific field has changed. at that point all i know is that at least 1 field changed. any ideas on that ?

thanks.

By Trent L. Taylor - 3/9/2009

Actually it will.  Look at this:

MyBO.CurrentRow(MyColumnName,Version)
By Philipp Guntermann - 3/9/2009

thanks, will have a closer look Smile