Last post Oct 10, 2009 07:31 PM by sjnaughton
Sep 29, 2009 09:24 PM|xaeryan|LINK
I'm trying to override the On_Updating event of one of my Dynamic Data fields and throw an exception under certain circumstances. For example:
Partial Public Class Section4
Private Sub OnContact_EmailChanging(ByVal value As String)
If Not [Char].IsUpper(value(0)) Then
Throw New ValidationException( _
"Email must start with an uppercase letter.")
While this works to catch the scenario, it just throws an unhandled exception, so I get an error page.
But according to the MSDN documentation,
"Any validation exceptions that are thrown in the data model are caught by the DynamicValidator control.
If a page contains a DynamicValidator control, the error can be displayed in the page."
So this is in my Edit.aspx, which has a DynamicValidator control. Are they wrong?
Sep 30, 2009 01:23 PM|sjnaughton|LINK
I think that this has been seen before and there was a fix for this as the error was being wrapped in some other exception see the ImprovedDynamicValidator.cs in the Dynamic Data Futures project here
Sep 30, 2009 01:33 PM|xaeryan|LINK
Shucks, I guess they haven't put this in DD4, as I'm using .NET 4 for this project.
Sep 30, 2009 02:33 PM|sjnaughton|LINK
You may be able to use this in DD v4 if you look how they wired it up in the old Futures project.
Sep 30, 2009 02:50 PM|xaeryan|LINK
Not gonna lie, I don't think I'd know where to start. I haven't found the plain-jane DynamicValidator hiding within the DynamicData folder, so I'm assuming it's a control in a library somewhere, but beyond that...
Sep 30, 2009 04:05 PM|DaveRuss|LINK
This article may be a good place to start.
Not quite the same reason, but it also requires the DynamicValidator to be enhanced so it might help.
Oct 01, 2009 09:50 AM|sjnaughton|LINK
The DynamicDataValidator is in the old Futures project inside the Controls folder.
Oct 10, 2009 05:42 PM|BrianPritchard|LINK
Will the DynamicValidator be fixed in the next DD release so we don't have to keep using the ImprovedDynamicValidator?
Oct 10, 2009 07:31 PM|sjnaughton|LINK
Good Question [:D] and did that get you the ImprovedDynamicValidator?