"Webforms unobtrusivevalidationmode requires" jquery "scriptresourcemapping

Source: Internet
Author: User

Error Introduction


Today, we are turning to verification controls.

When you use the requiredfieldvalidator control, everything is properly set and the following error occurs.




Solution


One solution is to copy ASPnet. scriptmanager. jquery. DL to the bin folder. In this way, the problem is solved, but another problem occurs, that is, after everything is set, I find that it does not pop up. Below is my code, only for demonstration, so no code is organized.

<asp:TextBox ID="TextBox1" runat="server" CausesValidation="True"></asp:TextBox>        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Text="*" ControlToValidate="TextBox1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>        <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />        <asp:ValidationSummary ID="ValidationSummary1" ShowMessageBox="true" runat="server" />

No matter how you look for it, you cannot find the above error because the above Code is correct. After I modify another error, this code can be run.



Control description


First, we will introduce the requiredfieldvalidator control, which is used to verify whether the text box is empty.

 

Controltovalidate: Specifies the control to be monitored

 

Errormessage: if an error occurs

 
Text: indicates the text displayed by requiredfieldvalidator when an error occurs.

 
In the first phase, validationsummary is used. I personally understand that this control is a summary of the above verification control.

 
Showmessagebox: whether to display the dialog box when an error occurs

 
Showsummary: When an error occurs, the error message is displayed at the validationsummary location.

 
Of course, the above two controls have other attributes. I just talked about common ones.



Advanced controls


 
Now let's talk about the reason for the above settings, but there is no pop-up window. This is my own empty web application. Through debugging tools, I found that jquery statements are introduced in the webpage, while empty web applications are created, jquery is not added to the program.

 
If you create a new form application (not empty), you will see another scripts folder, which contains the jquery version. js file.

 
On the console of the debugging tool in the browser, check which version of jquery file is missing and paste it to the corresponding path. In this way, the problem is solved perfectly.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.