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

4 posts, 0 answers
  1. Luc
    Luc avatar
    5 posts
    Member since:
    Feb 2012

    Posted 15 May 2013 Link to this post

    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


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


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

  2. Genady Sergeev
    Genady Sergeev avatar
    1600 posts

    Posted 20 May 2013 Link to this post

    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.
  3. Andrew
    Andrew avatar
    3 posts
    Member since:
    Sep 2012

    Posted 18 Aug 2014 in reply to Genady Sergeev Link to this post

    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.
  4. Slav
    Slav avatar
    1359 posts

    Posted 21 Aug 2014 Link to this post

    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: 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">
            <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=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
            <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />


    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.

Back to Top