<span id="Label3"></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">first, the background of the problem arises:<br></span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">When we knocked on the back page of the Beef Brisket press release system, we used the RequiredFieldValidator control (validation of the Non-empty control), which <span style="color:#FF0000">was forbidden to enter the specified content</span> . The RequiredFieldValidator control has an <span style="color:#000099">attribute InitialValue (the meaning of the initial value), and <span style="color:#000000">if it is empty, then the space will act as a prohibited input--no "null",</span> </span> Another , the spaces at both ends of the input are automatically removed before Validation. Of course, This space also has a property controltovalidate, this property is set to verify a control, in the Beef Brisket press release system, we use it to verify that we entered the user name, password, as well as the verification code is Empty.</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px; color:#000099">Cases:<br></span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px; color:#000099">The following code indicates that the RequiredFieldValidator control validates the Txtcode (captcha text box), that is, the verification code is not allowed to be empty!</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px; color:#000099"></span></p></p><pre name="code" class="html"><pre name="code" class="html"><asp:textbox id= "txtcode" runat= "server" CssClass = "textcode" ontextchanged= "txtcode_textchanged" ></asp: Textbox></pre></pre><pre name="code" class="html"><pre name="code" class="html"><asp:requiredfieldvalidator id= "RequiredFieldValidator3" runat= "server" errormessage= "please Enter the verification code" text= "*" ControlToValidate = "txtcode" ></asp:RequiredFieldValidator></pre></pre><span style="font-family:KaiTi_GB2312; font-size:18px"><span style="font-family:KaiTi_GB2312; font-size:18px">however, days days wondering people willing, beef brisket teacher with VS version and I use the VS version is not the same, I use the vs2012, he uses the Express version, the code will run error, the specific errors are as follows! </span></span><p><p></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px"><span></span></span></p></p><span style="font-family:KaiTi_GB2312; font-size:18px"><span style="font-family:KaiTi_GB2312; font-size:18px"><em> <span style="color:#FF0000">WebForms Unobtrusivevalidationmode needs "jquery" scriptresourcemapping. Please add a scriptresourcemapping named jquery (case-sensitive). </span></em></span></span><span style="font-family:KaiTi_GB2312; font-size:18px"><span style="font-family:KaiTi_GB2312; font-size:18px"></span></span><span style="font-family:KaiTi_GB2312; font-size:18px"><span style="font-family:KaiTi_GB2312; font-size:18px"><br></span></span><p><p></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">So I looked for the wrong solution on the internet, tried, the error solved successfully, but I really want to know the cause of the Error.</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">second, the cause of the error:</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">VisualStudio 2012 (or) WebForm 4.5 development, Many controls by default enable the unobtrusive Validationmode (so-called unobtrusive Validation, is a property of implicit authentication (related to the reference to jquery), but it is not assigned a value, programmer must be set manually. For example, the various validator used for data validation (the RequiredFieldValidator control used today), and the authorization and authenication settings, Because jquery is required to be called on the front-end for authentication, unobtrusive Validationmode is the default Enable. If this property is not configured, an error is Generated.</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">third, the solution</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">Register the attribute in global.asax, Add the global application class Global.asax file under the root directory, and add the following code to the Application_Start event:</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px"></span></p></p><pre name="code" class="html"><pre name="code" class="html"></pre></pre>The above code of consciousness is quoted is 1.4.1 version of jquery, of course, there are many ways to solve the error, I just introduced a kind of, if the bulky still want to use other methods, you can go online to Find. I'll give you a few links.<p><p></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">1, http://www.shaoqun.com/a/56680.aspx<br></span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">2, http://www.cnblogs.com/fancybit/articles/3616311.html</span><span style="font-family:KaiTi_GB2312; font-size:18px"><br></span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">third, Summary</span></p></p><p><p><span style="font-family:KaiTi_GB2312; font-size:18px">In the learning process, we always encounter problems, to the current level of learning, I particularly want to exercise their ability to find out, that is, in the course of learning we try to graves the knowledge to its plane, including the problems we encountered, we must find the root cause of the problem, when this problem solved, In his own heart there is a way to sweep the clouds to the senses, this feeling, cool!!!!!<br></span></p></p> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p>WebForms Unobtrusivevalidationmode needs "jquery" scriptresourcemapping.</p></p></span>
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