// the real code saves user, date, status codes, etc. to Note object public static void AppendNote(mmBindingList<NoteEntity> eNotes, string s) { if (!mmUtils.Empty(s)) { NoteEntity note = eNotes.AddNew(); note.someString = s; eNotes.EndNew(eNotes.Count); } }But when I go to save, the BO DataSet isn't changed.
public static void AppendNote(mmBindingList<NoteEntity> eNotes, NoteBusinessObject oNote, string s) { if (!mmUtils.Empty(s)) { NoteEntity note = eNotes.AddNew(); note.SetDataRow(oNote.NewRow()); // NEW code to set row ******* note.someString = s; eNotes.EndNew(eList.Count) } }2)----------------------------------------
// App_code Note utilities public class NoteUI { // NEW change to return count of Note List public static int AppendNote(mmBindingList<NoteEntity> eNotes, NoteBusinessObject oNote, string s) { int count = 0; if (!mmUtils.Empty(s)) { NoteEntity note = eNotes.AddNew(); note.SetDataRow(oNote.NewRow()); // NEW code ******* note.someString = s; eNotes.EndNew(eList.Count); count = eList.Count; } return count; } } // myPage.aspx.cs // ... private void DoBasicSave() { // always save new comments int noteCount = NoteUI.AppendNote(eNotes, oNote, this.txtComments.Text); // Save the DataSet (automatically binds back) mmSaveDataResult saveResult = this.Save(this.oParent, this.dsParent); if (saveResult == mmSaveDataResult.RulesPassed) { // go back to list Response.Redirect("default.aspx"); } else { // some kind of error, roll back comment to NOT save repeatedly if (noteCount > 0) { eNotes.RemoveAt(noteCount); } } }I would imagine this is a somewhat common problem. Anyone have a better way to do it?