Hi David,
I followed your instructions and so far it didn’t work.
Here are my steps:
1. I created MyDynamicValidator.cs file and placed it in the App_Code folder.
The file contains your code verbatim from your post above.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.DynamicData;
using System.ComponentModel.DataAnnotations;
public class MyDynamicValidator : DynamicValidator
{
protected override void ValidateException(Exception exception)
{
// If it's not already an exception that DynamicValidator looks at
if (!(exception is IDynamicValidatorException) && !(exception is ValidationException))
{
// Find the most inner exception
while (exception.InnerException != null)
{
exception = exception.InnerException;
}
// Wrap it in a ValidationException so the base code doesn't ignore it
exception = new ValidationException(null, exception);
}
base.ValidateException(exception);
}
}
2. I modified the web.config file as shown below:
<pages>
…
<tagMapping>
<clear />
<add tagType="System.Web.DynamicData.DynamicValidator" mappedTagType="MyDynamicValidator"/>
</tagMapping>
</pages>
I placed a break point inside body of the MyDynamicValidator class. The Dynamic Data application flow never came to the MyDynamicValidator class.
It looks like that it was ignored. The Internet browser showed an error message in the message box:
Line: 4723
Error: Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.
Is it possible that something else is missing? Please advise.
Regards,
Yitzhak