In ASP.NET Web Application Visual Basic the RequiredFieldValidator does't work - by Виктор Зиборов

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


15
0
Sign in
to vote
ID 735928 Comments
Status Closed Workarounds
Type Bug Repros 9
Opened 4/8/2012 3:11:55 AM
Access Restriction Public
Moderator Decision Sent to Engineering Team for consideration

Description

Browser gets:
"Server Error in '/' Application.
WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive). "
Sign in to post a comment.
Posted by M.Sengupta on 8/2/2015 at 8:40 AM
When I was building the .aspx project. It is showing build errors & in error list it is showing Program 'c:\inetpub\wwwroot\masterdemo\masterdemoapp\obj\Debug\masterdemo.exe' does not contain a static 'Main' method suitable for an entry point. How to overcome, plz guide me.
Posted by César Campos on 1/22/2014 at 9:26 AM
The way you could disable the Unobstrusive validation mode is with the line:

    <appSettings>
        ...
        ...

     <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
    </appSettings>
Posted by Trapulo on 10/23/2012 at 8:47 AM
Ok, but if I reference jquery using bundling?

bundles.Add(New ScriptBundle("~/bundles/jquery", "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js").Include(
                 "~/Scripts/jquery-{version}.js"))

the validator will load a second reference to jquery and block the page!
Posted by dotBomb on 9/6/2012 at 6:34 PM
Also experiencing the same issue with an Express Web 11 solution upgraded to 2012 RC version. Here is my web.config:


<?xml version="1.0"?>

<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->

<configuration>
    <connectionStrings>
        <add name="EventsConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Events.mdf;Integrated Security=True"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
    <appSettings>
     <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
     <!--<add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms" />-->
    </appSettings>
    <system.web>
     <authorization>
        <deny users="?" />
     </authorization>
     <roleManager enabled="true" />
     <authentication mode="Forms" />
     <compilation debug="true" targetFramework="4.5" />
     <httpRuntime requestValidationMode="4.5" targetFramework="4.5" encoderType="System.Web.Security.AntiXss.AntiXssEncoder, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
     <pages controlRenderingCompatibilityVersion="4.5" />
     <machineKey compatibilityMode="Framework45" />
     <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
        <providers>
         <clear />
         <add name="XmlSiteMapProvider"
             description="Default SiteMap Provider"
             type="System.Web.XmlSiteMapProvider"
             siteMapFile="Web.sitemap"
             securityTrimmingEnabled="true" />
        </providers>
     </siteMap>
    </system.web>

</configuration>
Posted by Rifad on 8/23/2012 at 10:58 AM
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
</system.web>
</configuration>

The above is my webconfig file,I dont have
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="WebForms" /> line in my web config file and i am still getting the error.

Posted by Scott [MSFT] on 4/9/2012 at 7:51 PM
When targeting .NET 4.5 we enable Unobtrusive Validation by default. You need to have jQuery in your project and have something like this in Global.asax to register jQuery properly:

            ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition {
                Path = "~/scripts/jquery-1.4.1.min.js",
                DebugPath = "~/scripts/jquery-1.4.1.js",
                CdnPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.min.js",
                CdnDebugPath = "http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.1.js"
            });

Replacing the version of jQuery with the version you are using. You can also disable this new feature in web.config by removing the following line:

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

The templates in the RC milestone will have all of this wired up automatically for you.
Posted by MS-Moderator07 [Feedback Moderator] on 4/8/2012 at 11:41 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 4/8/2012 at 6:47 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)