简体   繁体   中英

Visual Studio 2015 / asp.net framework : requiredFieldValidator issue

PROBLEM :

  1. I have problem with RequiredFieldValidator in Visual Studio 2015 (ASP.NET).
  2. The Problem is ErrorMessage doesn't want to fire whenever i add Text Properties.

Code 1 (With Text Properties):

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter Your Name" ControlToValidate="Name" CssClass="ErrorMessage" Text="*"></asp:RequiredFieldValidator>

Before Pressed Button ( No Text Seen ):

After Pressed Button :

*

Code 2 (Without Text Properties):

<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Enter Your Name" ControlToValidate="Name" CssClass="ErrorMessage"></asp:RequiredFieldValidator>

Before Pressed Button ( No Text Seen ):

After Pressed Button :

Enter Your Name


What i want try to do

Before Pressed Button :

*

After Pressed Button :

Enter Your Name


Previously, i had issue with error :

WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'. Please add a ScriptResourceMapping named jquery(case-sensitive).

and i got the solution : here

by add the following code :

  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>

But, now i'm facing new issue with the text properties.. i don't know what the problems. Any help would be appreciate. Thx in advance.

在PageLoad事件上,您要做的是foreach(RequiredFieldValidator会查看Validation == true,然后将文本更改为*并显示RequiredFieldValidator。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM