This is a migrated thread and some comments may be shown as answers.

Validators in Asp.Net 4.5 and the new Unobtrusive Validation Mode

3 Answers 158 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Luc
Top achievements
Rank 1
Luc asked on 15 May 2013, 07:21 AM
Client side Validators ( for example CustomValidator)  work differently in ASP.Net 4.5.
Microsoft calls it Unobtrusive Validation Mode, and they are using jusing jQuery (2.0) for this.
Telerik Controls 2013 Q1 SP2 alre also using using jQuery ( but still version 1.9)

The problem is when using scriptmanager, or RadScriptmanager, after loading the telerik jQuery libraries, client side validators do not work any more. This took me some hours, looking at all kind of possible solutions, but finally the most simple solution is disabling the new functionality by adding a setting in Web.config

<appSettings>
 ...

 <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>

</appSettings>


So since jQuery looks to be standard in asp.net 4.5 , it would be a good thing if Telerik would use the same libraries.

Luc

3 Answers, 1 is accepted

Sort by
0
Genady Sergeev
Telerik team
answered on 20 May 2013, 02:54 PM
Hello Luc,

We are aware of the problem and will address in the very near future (perhaps for the Q2 release). One of the main problems we have is that Microsoft expects that you will have jQuery in the global jQuery variable while we provide jQuery only in the $telerik.$ field.

The way around as of now is to disable the embedded jQuery and register your own jQuery on the page. I will update the thread as soon as we have a better solution.


All the best,
Genady Sergeev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrew
Top achievements
Rank 1
answered on 19 Aug 2014, 02:36 AM
Is this resolved yet ?
I am using 2014.2.618.45 in an ASP.NET 4.5 web forms application and as far as I can see client side validation is not working at all. Wasted a couple of hours until I found this post and decided to try turning off unobtrusive validation which seems to have resolved the issue.
0
Slav
Telerik team
answered on 21 Aug 2014, 12:56 PM
Hello Andrew,

Proper resource mapping for the jQuery library that is embedded in the Telerik controls exists in the latest version of the controls (2014.2.724) when RadScriptManager is used on the page.

Nevertheless, the unobtrusive validation still breaks due to how the script management features work, as stated in the following feedback item: https://connect.microsoft.com/VisualStudio/feedback/details/748064/. This means that by design you need to instruct the script manager on the page to load jQuery before the core scripts of the client-side validation.

To do so with the RadScriptManager, you can use the sample code below:
<telerik:RadScriptManager runat="server" ID="ScriptManager1">
    <Scripts>
        <asp:ScriptReference Name="Telerik.Web.UI.Common.Core.js" Assembly="Telerik.Web.UI" />
        <asp:ScriptReference Name="Telerik.Web.UI.Common.jQuery.js" Assembly="Telerik.Web.UI" />
        <asp:ScriptReference Name="Telerik.Web.UI.Common.jQueryInclude.js" Assembly="Telerik.Web.UI" />
        <asp:ScriptReference Name="WebForms.js" Assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </Scripts>
</telerik:RadScriptManager>


Regards,
Slav
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Luc
Top achievements
Rank 1
Answers by
Genady Sergeev
Telerik team
Andrew
Top achievements
Rank 1
Slav
Telerik team
Share this question
or