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
1050
RecordAdded event problem
posted

when i tried to create a record, field values are empty in RecordAdded event.

private void dg_RecordAdded(object sender, RecordAddedEventArgs e)

{

e.Record.Cells["FieldName1"].Value.ToString()

}

is this the correct way to retrieve the values???

or i am doing something wrong.

if there is any example for adding new records please direct me.

thanks

Parents
  • 8576
    Offline posted
    Hi -
     
    The RecordAdded event is fired as soon as the user clicks in the Add Row and types the first character in any cell.  At this point there is obviously no data in the record.  The RecordUpdated event will then fire when the user is finished editing (at which time the cell values will be available) - the timing of the RecordUpdated event is determine by the XamDataGrid.UpdateMode property which takes an enumeration with the following values:
     
    • OnCellChange
    • OnCellChangeOrLostFocus
    • OnRecordChange
    • OnRecordChangeOrLostFocus
    • OnUpdate
    To force the RecordUpdated event to fire only after the user 'moves off' the Add Record, set the UpdateMode to OnRecordChange.
     
    BTW - for best performance you should generally use the Record's GetCellValue method to get the value in a cell rather than accessing the Cells collection since the GetCellValue method will not allocate a Cell object, while accessing the Cells collection directly will.
     
    Joe
     
     
Reply Children