My Site.master page wraps most everything in an UpdatePanel.
When a ValidationException is thrown from a result of OnValidate on the data model, I would have expected Page.IsValid to be false.
In my scenario,
- I am using a DetailsView bound to a LinqDataSource in a UserControl.
- I am not debugging javascript
- ValidationGroup is not set
When I manually call detailsView.Insert(), I notice OnValidate gets called and throws a ValidationException as expected. The LinqDataSource.Inserted event indicates the exception, but Page.IsValid is still true which is unexpected.
icnocop
Member
16 Points
9 Posts
LinqDataSource not setting Page.IsValid if ValidationException is thrown in OnValidate event of d...
Aug 01, 2010 09:13 PM|LINK
Hi.
I am experiencing very similar behavior as the post indicated here:
http://stackoverflow.com/questions/2253981/dynamicdata-validation-exception-message-caught-in-javascript-not-dynamicvalidat
Visual Studio 2010.
ASP.NET 4
Dynamic Data 4
My Site.master page wraps most everything in an UpdatePanel.
When a ValidationException is thrown from a result of OnValidate on the data model, I would have expected Page.IsValid to be false.
In my scenario,
- I am using a DetailsView bound to a LinqDataSource in a UserControl.
- I am not debugging javascript
- ValidationGroup is not set
When I manually call detailsView.Insert(), I notice OnValidate gets called and throws a ValidationException as expected. The LinqDataSource.Inserted event indicates the exception, but Page.IsValid is still true which is unexpected.
Is this a bug?
Any ideas?
Thank you!
icnocop
Member
16 Points
9 Posts
Re: LinqDataSource not setting Page.IsValid if ValidationException is thrown in OnValidate event ...
Aug 01, 2010 11:05 PM|LINK
I also wanted to mention that my ScriptManager is actually the AjaxToolkit ScriptManager v4.1.40412.
EnablePartialRendering="true"
The <asp:CommandField /> I am using to manually call detailsView.InsertItem(true) has CausesValidation="true" .
I would have expected the DynamicValidator in Text_Edit.ascx to catch the exception.
asp.net 4.0 dynamicdata linqdatasource DetailsView validation OnValidate DynamicValidator
icnocop
Member
16 Points
9 Posts
Re: LinqDataSource not setting Page.IsValid if ValidationException is thrown in OnValidate event ...
Aug 02, 2010 07:24 PM|LINK
With Visual Studio 2008 SP1, ASP.NET 3.5 SP1, DynamicDataFutures0716, and tagMapping ImprovedDynamicValidator, it worked as expected.
But now that I've upgraded to VS2010, ASP.NET 4, and Dynamic Data 4 (removed DynamicDataFutures), it no longer works as expected.
Any troubleshooting advice?
Thank you.
icnocop
Member
16 Points
9 Posts
Re: LinqDataSource not setting Page.IsValid if ValidationException is thrown in OnValidate event ...
Aug 02, 2010 07:48 PM|LINK
I think I found the answer here:
http://forums.asp.net/t/1476131.aspx
http://blogs.msdn.com/b/davidebb/archive/2008/12/11/handling-database-exceptions-in-dynamic-data.aspx
I will have to use a new ImprovedDynamicValidator for DD4 and ASP.NET 4.