Raising the ErrorSavingEvent


Author
Message
Charles Thomas Blankenship...
Charles Thomas Blankenship
Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K
Howdy StrataFramers:



I'm trying to handle the ErrorSaving event of a business object that is used on an .ASPX page and that is referenced in the ApplicationBasePage as such.



Public WithEvents oPrefix As Prefix



On the page where the saving is taking place I put the following code as per the help topic ErrorSaving:



Private Sub ErrorSaving(ByVal e As MicroFour.StrataFrame.Business.ErrorSavingEventArgs) Handles oPrefix.ErrorSaving



Dim lcErrorText As String = ""

lcErrorText = Me.GenerateWarningTable(e.ToString)

SetErrorsLabelState("Show", lcErrorText)



End Sub



But I get an error saying the signatures do not match. It looks like the ErrorSaving example caters to WinForms so I guess my question is how do I snag this event in an ASPX page so I can capture the Unique Key Violation message from the database and display it to the user. I tried the same thing in the web example from Micro4 and the same error occurs. I guess I'm doing the same thing incorrectly in both places. Wink



Thanks guys,



CT

Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
Replies
Charles Thomas Blankenship...
Charles Thomas Blankenship
Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)Advanced StrataFrame User (708 reputation)
Group: Awaiting Activation
Posts: 172, Visits: 12K
You ain't gonna believe this but I removed all of my custom code from the business object (AddHandler, custom method, mapping the event to the method in the object itself) and reran the code. Guess what, the error is still there in design time but the event is surfacing as expected now. It even runs twice (I put a Breakpoint in there just to make sure). Sure enough, the event loops twice.



Why is this code executing even though the design time is registering an error? Sometimes this stuff makes me feel nuttier than a fruitcake.



CT

Charles T. Blankenship
Senior Consultant
Novant Consulting, Inc.
704.975.7152
http://www.novantconsulting.com
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
When code starts executing twice, this is generally a sure fire indication that you have more than one handler.  Since an event can be managed by multiple handlers, if the handler is not removed (or one gets added that is not expected) then you have code re-execution.  This doesn't sounds like a BO issue...it is more than likely coming from a handler you have added someplace...and keep in mind you are working on the web, so if the form is posted and you did not remove the previous handler, you could then have multiple handlers.  Be sure to keep the IsPostBack property in mind on the web when manually creating or adding handlers.
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