After updating to the latest version (2025.1.218), I received an error on only one of my pages where I'm using the asp:RequiredFieldValidator.
The error stated that WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'...
Initially, I added the script mapping to the global.asax.cs page, but then discovered I could just disable UnobtrusiveValidation in the web.config.
The error was resolved with each of these solutions, but I wanted to get away from modifying the global.asax page, so I went with the web.config setting.
My questions are what has changed that led to this error, and which method is recommended? What are the ramifications of simply disabling it in the web.config?
2 Answers, 1 is accepted
Hi Jeff,
Thank you for the follow-up.
We haven’t made any changes to the source code in this release. The only significant update related to framework versions was in 2024 Q2 (2024.2.513) when we updated our assemblies to target .NET Framework 4.6.2 instead of 4.5. While this shouldn't directly impact validation behavior, upgrading the framework version can sometimes result in different default settings being enforced—particularly for client-side validation mechanisms like UnobtrusiveValidationMode.
Since your applications were already on .NET 4.7.2, it's interesting that this issue is appearing now. The behavior might be influenced by a combination of factors, such as:
- Specific page configurations
- Script references and how they are registered
- How the RequiredFieldValidator interacts with Unobtrusive Validation defaults
It’s possible that the update has indirectly surfaced this requirement in scenarios where it wasn't previously enforced.
If you haven't already, I’d recommend checking:
- Whether jQuery is properly registered in your application’s ScriptResourceMapping
- If there are differences in how client-side validation scripts are loaded across affected pages.
Let us know if you identify any patterns or if we can assist further in troubleshooting.
Regards,
Rumen
Progress Telerik
Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!
Rumen,
Significant update to my issue below, but first:
Thank you for the quick reply. This is the first update we've performed since the update you mentioned, so that may explain why this issue is just now surfacing. However, we upgraded to target 4.7.2 approximately two years ago.
jQuery was not registered in the ScriptResourceMapping, and we do not explicitly load any jQuery scripts in the head tag, or anywhere else. Presumably, we rely on the scripting you have in the application.
Significant update: I discovered that disabling UnobtrusiveValidation by adding web.config key does NOT completely resolve my issues. We're also using a CustomValidator and that was not working with the validation disabled.
When I removed the web.config key and adding the ScriptResource Mapping to the global.asax page, all works as expected, including the CustomValidator. Should we consider this problem resolved? Again, I've not added any ScriptManager references, as the link you provided states - https://www.telerik.com/products/aspnet-ajax/documentation/knowledge-base/unobtrusive-validation-net45-telerik-site-app
Thank you,
Jeff.
Disabling UnobtrusiveValidation in web.config is a workaround, but it doesn’t fully resolve the issue when using a CustomValidator. This suggests that some client-side validation scripts still depend on jQuery being available, even when unobtrusive validation is disabled.
Your approach—registering jQuery in global.asax—is the correct way to resolve the issue while keeping UnobtrusiveValidation enabled. As long as everything is working as expected now and you’re not facing new validation-related issues, this should be considered resolved.
If you ever encounter unexpected validation behavior in other pages, I’d recommend checking whether they also rely on jQuery for client-side validation and confirming that the script is properly loaded there as well.
Hi Jeff,
This error typically appears in .NET applications and controls that have been upgraded to .NET 4.6 and above. With these newer versions, the default behavior for client-side validation has shifted towards using unobtrusive validation. This means that, in order to avoid the error, you have two options:
- Disable Unobtrusive Validation: By adding the following key in your web.config file, you revert the behavior to that of earlier .NET versions:
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
...
</appSettings>
- or Configure Your Application for Unobtrusive Validation: Alternatively, you can update your application's code to properly support unobtrusive validation. This approach can provide cleaner HTML and a separation of concerns, but it requires modifying your app to work with the new validation framework.
Let me know if you need further assistance or have any questions about these changes.
Regards,
Rumen
Progress Telerik
Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!
Rumen,
Thank you for the information. We have several applications, and each of them were upgraded to target the 4.7.2 .Net framework quite some time ago. This is the first time I've encountered such an error. Is it due to the RequiredFieldValidator element in use, and can we expect this error anywhere this element is used?
Thanks,
Jeff