Error : WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery. Please add a ScriptResourceMapping named jquery(case-sensitive).
This article explains that how can remove an error that is title of article in .Net Framework 4.5. This error comes when you used the RequiredFieldValidator control on any other server control. Let’s see with an example.
Create Web Form
You need to create a web form that has one textbox for user input and a button. The TextBox control has a required field validator control.
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ValidationApplication.Default" %>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head id="Head1" runat="server">
- <title>Required Field example</title>
- </head>
- <body>
- <form id="form1" runat="server">
- <div>
- Name :
- <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
- <asp:RequiredFieldValidator ID="reqName" runat="server" Display="Dynamic" ControlToValidate="txtName"
- Text="Name is empty" Style="color: red"></asp:RequiredFieldValidator>
- <asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click" />
- </div>
- </form>
- </body>
- </html>
Server Side Code
You need to create a click event of button that shows input values.




Jawed ShaikhPosted Mar 13, 2020, 10:10 AM
Does the solution cause any security issue?
manish joshiPosted Oct 11, 2018, 10:37 AM
Another solution is to register the script: In Global.asax Application_Start add mapping to your jQuery file path: void Application_Start(object sender, EventArgs e) { // Code that runs on application startup ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition { Path = "~/scripts/jquery-1.7.2.min.js", DebugPath = "~/scripts/jquery-1.7.2.min.js", CdnPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.min.js", CdnDebugPath = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.1.js" }); } Some details from MSDN: ValidationSettings:UnobtrusiveValidationMode Specifies how ASP.NET globally enables the built-in validator controls to use unobtrusive JavaScript for client-side validation logic. 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.
manish joshiPosted Oct 11, 2018, 10:30 AM
Check this link for more details
manish joshiPosted Oct 11, 2018, 10:30 AM
Http://connect.microsoft.com/VisualStudio/feedback/details/735928/in-asp-net-web-application-visual-basic-the-requiredfieldvalidator-doest-work
Gopi PPosted Sep 3, 2018, 3:06 AM
It's really helpful. But, if you explain the causes of the issue that would be more help to understand it well.
narasimha asaPosted May 8, 2018, 6:17 AM
Good Answer sir for update more doubts
sachin thorkarPosted Apr 13, 2018, 6:13 AM
Thanks a Lot Sir .....it saved my time
Malik BismaPosted Jan 30, 2018, 7:07 AM
It was helpful.Thank you Very Much.
Malik BismaPosted Jan 30, 2018, 7:06 AM
Thank You Very Much.
Shubham AgrawalPosted Sep 19, 2017, 4:03 AM
But i have still error.
Vishnu ReddyPosted Sep 6, 2017, 2:36 AM
Thanks and very helpful for me
Rana Asif NaseerPosted Sep 5, 2016, 5:19 AM
It's really helpful thank you so much!
Lai AmassakPosted Jul 1, 2016, 6:47 AM
Great, it works but next time please be more specific in your explanation like mentioning which file to edit i.e 'Web.config'. Not everyone knows where '<appSettings>' is. Thanks.
Vinay SinghPosted Jun 10, 2016, 2:33 AM
Nice thanks very helpful…
Sandeep Singh ShekhawatPosted May 27, 2016, 12:02 AM
Thank all :)
Suresh MolabantiPosted May 26, 2016, 1:47 AM
thank you sir it's very helpful
Kuppurasu NagarajPosted Feb 16, 2016, 6:47 AM
nice
Debendra DashPosted Nov 11, 2015, 5:24 AM
Thanks...work for me....
sandeep tripathiPosted Nov 5, 2015, 1:24 AM
Really Helpful! Thank you so much
Sunny SharmaPosted Jun 24, 2015, 2:30 AM
Nice Share!
saham sasidharanPosted Jun 14, 2015, 4:24 AM
Thankzz broo :D
RamakrishnaPosted Apr 3, 2015, 3:10 PM
Really Helpful!
Saber ShaikhPosted Feb 2, 2015, 4:09 AM
thanks
Saber ShaikhPosted Feb 2, 2015, 4:08 AM
good
brajesh singhPosted Jan 12, 2015, 4:45 PM
thanks it really helpful ....
shubhamPosted Aug 18, 2014, 12:08 PM
it still shows the same error!! please help!