code K.O.
code K.O.

Reputation: 171

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.

Upvotes: 0

Views: 477

Answers (1)

Abdus Samad
Abdus Samad

Reputation: 54

on PageLoad event what you have to do is foreach (RequiredFieldValidator look if Validation==true then change the text to * and show the RequiredFieldValidator..

Upvotes: 1

Related Questions