Google Analytics İzleme

04 Kasım 2016

Asp.net - WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery' hatası


Asp.net 4.5 olan web form uygulamasını visual studio içinde çalıştırırken "WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery' ..." gibi aşağıdaki hatayı aldım.
Asp.net 4.5 ile beraber asp.net default(örn: RequiredFieldValidator) validasyon kontolleri için jquery kullanımına geçilmiş.

ValidationSettings:UnobtrusiveValidationMode
Specifies how ASP.NET globally enables the built-in validator controls to use unobtrusive JavaScript for client-side validation logic.
Remarks:
If this key value is set to "None" [default], the ASP.NET application will use the pre-4.5 behavior (JavaScript inline in the pages) for client-side validation logic. If this key value is set to "WebForms", ASP.NET uses HTML5 data-attributes and late bound JavaScript from an added script reference for client-side validation logic.

Web uygulamasının Web.config dosyasında görünen .net versiyonu:
--
<system.web>
      <compilation debug="true" targetFramework="4.5" />
      <httpRuntime targetFramework="4.5" />
</system.web>
--

Asp.net web sayfasını çalıştırınca çıkan hata mesajı:

"
WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).
"






Unobtrusive validasyonu kapatmak için aşağıdaki işlemler yapılıyor:
--
There are at least three ways to disable the use of unobtrusive JavaScript for client-side validation:
  1. Add the following to the web.config file:
    <configuration>
      <appSettings>
        <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
      </appSettings>
    </configuration>
  2. Set the value of the System.Web.UI.ValidationSettings.UnobtrusiveValidationMode static property to System.Web.UI.UnobtrusiveValidationMode.None
  3. Set the value of the System.Web.UI.Page.UnobtrusiveValidationMode instance property to System.Web.UI.UnobtrusiveValidationMode.None
To disable the functionality on a per page basis, I prefer to set the Page.UnobtrusiveValidationModeproperty using the page directive:
<%@ Page Language="C#" UnobtrusiveValidationMode="None" %>
--

Alıntı:
http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery
http://stackoverflow.com/questions/16005789/asp-net-requiredfieldvalidator-visualstudio-2012
http://mehmetelibol.blogspot.com.tr/2012/08/visual-stdio-2012-de-bugun-karslastgm.html
http://stackoverflow.com/questions/16660900/webforms-unobtrusivevalidationmode-requires-a-scriptresourcemapping-for-jquery
http://www.c-sharpcorner.com/UploadFile/3d39b4/error-webforms-unobtrusivevalidationmode-requires-a-script/?

ASP.NET appSettings Element
asp.net'in kullandığı default tanımlar:
https://msdn.microsoft.com/en-us/library/hh975440.aspx

ASP.NET 4.5 ScriptManager Improvements in WebForms

All about <httpRuntime targetFramework>




Hiç yorum yok: