StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
Business Objects and Data Access (How do I?)
»
The Navigating event and Adding a record
The Navigating event and Adding a record
Post Reply
Like
0
The Navigating event and Adding a record
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Greg McGuffey
Greg McGuffey
posted 17 Years Ago
ANSWER
Topic Details
Share Topic
Group: Forum Members
Posts: 2K,
Visits: 6.6K
I am reacting to the Navigating event of a BO, to see if it is dirty and then allow the user to handle it if it is dirty. It appears to be raised AFTER the new row is added but before it is navigated to. The code I'm using in the Navigating event is:
If e.BusinessObject.IsDirty Then
' Confirm message
'...setup MessageItem so we can use MessageForm() to get result
Select Case MessageForm.ShowMessage(msgItem)
Case MessageFunctionType.Yes
e.BusinessObject.Save()
Case MessageFunctionType.No
e.BusinessObject.Undo(CurrentRowOnly)
Case MessageFunctionType.Cancel
' Cancel nav and any thing else to reset UI
e.Cancel = True
End Select
The problem is that when I click a button that calls the Add() method of the BO. This then calls the Navigating event handler (at some point) after the new record is added (which I guess makes sense). If the editing state of the BO is idle (not editing anything when Add() was called), the BO is dirty already. This then blows up because there is nothing to save or undo and canceling cancels the navigation to the new record! I'm not sure how to handle the case of a new record. Ideas?
I'm doing it this way because I have a listbox that allows the user to view all available records and navigate via the listbox.
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search