Tanumay99 Ответов: 2

ASP.net RequiredFieldValidator VisualStudio 2012


Я разрабатываю проект с помощью ASP.net c# в Visual Studio 2012. Я добавляю валидатор, и он отлично работает в Visual Studio 2010. но в Visual Studio 2012 я получаю сообщение об ошибке:
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() +2170338
   System.Web.UI.WebControls.BaseValidator.RegisterUnobtrusiveScript() +10
   System.Web.UI.WebControls.BaseValidator.OnPreRender(EventArgs e) +9575857
   System.Web.UI.Control.PreRenderRecursiveInternal() +83
   System.Web.UI.Control.PreRenderRecursiveInternal() +168
   System.Web.UI.Control.PreRenderRecursiveInternal() +168
   System.Web.UI.Control.PreRenderRecursiveInternal() +168
   System.Web.UI.Control.PreRenderRecursiveInternal() +168
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +974

Пожалуйста, Помогите Мне.

2 Ответов

Рейтинг:
16

Tanumay99

Я нашел решение.наблюдать это
http://stackoverflow.com/questions/16005789/asp-net-requiredfieldvalidator-visualstudio-2012[^]


Рейтинг:
1

John Shine

у меня такая же проблема..


вы просто щелкаете правой кнопкой мыши, чтобы добавить новые элементы - >глобальный класс приложения для global.asax.
затем добавьте класс, приведенный ниже..


void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup
        ScriptResourceDefinition myScriptResDef = new ScriptResourceDefinition();
        myScriptResDef.Path = "~/scripts/jquery-1.8.1.js";
        myScriptResDef.DebugPath = "~/scripts/jquery-1.8.1.js";
        myScriptResDef.CdnPath = "http://code.jquery.com/jquery-1.8.1.js";
        myScriptResDef.CdnDebugPath = "http://code.jquery.com/jquery-1.8.1.js";
        ScriptManager.ScriptResourceMapping.AddDefinition("jquery", null, myScriptResDef);

    }




затем начните отладку.
это наверняка сработает..