Data is not save from editable Grid


Author
Message
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Hehe, yes, it is possible to save the data from the grid.  But like you said in your post above, most grids make you edit the editing cell to comitt the data back to the data source.
Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)
Group: Forum Members
Posts: 29, Visits: 79
My code works! I forgot to exit the cell of the grid in order to accept the changesBigGrin

Hope that my code can help...

Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)
Group: Forum Members
Posts: 29, Visits: 79
it will simpler to know if it is possible to save date from an editable grid using the BO. If yes, how?
StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Does the propositionDetailBO still think it's dirty after the save (propositionDetailBO.IsDirty == true)?  And how exactly do you have the DataSource on the grid configured?  Did you set the CurrentDataTable as the data source directly, or did you set the BusinessBindingSource as the data source directly and set the BusinessObject property on the BBS to the propositionDetailBO?
Joseph-Carl Theodat
Joseph-Carl Theodat
StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)StrataFrame Beginner (29 reputation)
Group: Forum Members
Posts: 29, Visits: 79
Hi,

The following code is used to save the data from and editable grid which has a BusinessBindingsource.CurrentTable as the datasource.

private void tsSave_Click(object sender, EventArgs e)

{

bool ok = false;

MicroFour.StrataFrame.Data.SaveUndoResult saveStatus;

try

{

//Start the transaction

BusinessLayer.TransactionBegin("", System.Data.IsolationLevel.ReadCommitted);

saveStatus = propositionVersionBO.Save(true);

if (saveStatus == MicroFour.StrataFrame.Data.SaveUndoResult.Success)

{

if (propositionDetailBO.IsDirty)

if (propositionDetailBO.Save(true) == MicroFour.StrataFrame.Data.SaveUndoResult.Success)

ok = true;

}

}

catch (Exception)

{ // Not supposed to happen

// Write to Log entity

}

finally

{

if (ok)

{

// Everything succeeds, so it's time to commit

BusinessLayer.TransactionCommit("");

dgPropositionVersion.EditMode = DataGridViewEditMode.EditProgrammatically;

tsSave.Enabled = false;

tsUndo.Enabled = false;

tsEdit.Enabled = true;

}

else

{

// Error occurs, so rollback

BusinessLayer.TransactionRollback("");

// Keep business objects in edit mode

Edit();

}

}

}

For some reason the the after the commit, the primaryBO (not using grid) is updated but the other one (propositionDetailBO using grid) is not. What's wrong? I cant see the grid has the previous values after the commit... Without having the devexpress grid, is it possible to have an editable grid from the 2.0 framework to work with the BO?... If not do you have any plan to resolve the issue...

P.S

Sorry for the code indentation (cut & paste)


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search