31 Ağustos 2012 Cuma

Visual Stdio 2012 de bugün karşılaştığım bir hata

Server Error in '/' Application.


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

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidOperationException: WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).]
   System.Web.UI.ClientScriptManager.EnsureJqueryRegistered() +2170706
   System.Web.UI.WebControls.BaseValidator.RegisterUnobtrusiveScript() +10
   System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +9576593
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +168
   System.Web.UI.Control.PreRenderRecursiveInternal() +168
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974

Bu hataya çözüm olarak Jquery  kütüphanesini indirip, projemde bir klasör içine kaydettim.


 Globl.ascx dosyası içersine


        protected void Application_Start(object sender, EventArgs e)
        {

            ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition
            {
                Path = "~/js/jquery-1.8.1.min.js",
                DebugPath = "~/js/jquery-1.8.1.min.js",
                CdnPath = "~/js/jquery-1.8.1.min.js",
                CdnDebugPath = "~/js/jquery-1.8.1.min.js"
            });
        }

kodlarını ekleyerek bu hatadan kurtulmuş oldum.

Veya

 Webconfig içine bu kodları indirmeye gerek kalmadan.


  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="none"/>
  </appSettings>

kodlarını yazabilirsiniz


8 yorum:

Gökhan ZER dedi ki...

teşekkürler, sıyırmak üzere idim... :)

Adnan Ertörer dedi ki...

çok teşekkür ederim :)

Unknown dedi ki...

Hay ALLAH razı olsun. Çok makbule geçti.

enginsoft dedi ki...

Çok teşekkür ederim.
Ben 2. seçeneği uyguladım ve sorun çözüldü :)

behiye dedi ki...

Çoook sağolun yaa :D

Unknown dedi ki...

yarına proje yetiştircem 2 saattir bir validationu eklemeye
uğraşıyorum Allah razı olsun nasıl dua etcem bilemezsiniz:))

Adsız dedi ki...

Teşekkürler :)

gazi dedi ki...

teşekkürler kardesim kafayı yiyecektim