An important aspect of creating ASP.NET Web pages for user input is to be able to check that the information users enter is valid. ASP.NET provides a set of validation controls that provide an easy-to-use but powerful way to check for errors and, if necessary, display messages to the user. The topics in this section describe the validation controls and how to use them.
Questions tagged [asp.net-validators]
39 questions
17
votes
4 answers
How to get the 'controlToValidate' property on ClientValidationFunction?
Lets say I have this code.
And a…

DJPB
- 5,429
- 8
- 30
- 44
3
votes
1 answer
Use asp-validation-for without binding to model property
In the past I have always used the following code to make something globally clear, like with a login form, when the username or the password are not correct. I dont want this error message to link to a specific model property like Username or…

Max
- 846
- 1
- 9
- 26
2
votes
0 answers
validation of interest rate using onkeypress event
I have a textbox where user enters interest rate. The valid value format of this input are as follows,
only integer or decimal.
I have used asp.net validator for this as:

nischalinn
- 1,133
- 2
- 12
- 38
2
votes
1 answer
how to show multiple validation messages in view of MVC5
My view has a textbox(Email) and a submit button.
@using (Html.BeginForm("FindMyDetail", "ResetPassword", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
Enter your email.
…
kaarthick raman
- 793
- 2
- 13
- 41
2
votes
1 answer
ASP.NET MVC Model bindING separate day, month, year string fields to single DateTime object
I am currently building a form that requires the user to enter their date of birth. I have determined that the most user friendly way to do this is through separate date day, month, and year input fields.
I have a strongly typed view that contains…

CodeMonkey
- 119
- 4
- 12
1
vote
1 answer
Validation Not Firing On TextBox
So, basically I have multiple TextBoxes on my page and some of them have validations with RequiredFieldValidator.
I am using OnTextChanged event on txtMobileNo TextBox Field to fetch the data from database.
If the number exists in the database the…

Manish Jha
- 263
- 2
- 13
1
vote
1 answer
How to show asp-for-validation error message in a tooltip instead of span
ASP.NET Core has beautiful way of handle valiadtion. But the validation style showing in frontend is very old school. The way i have followed:
Custom model annotation with error message:
[Required(ErrorMessage = "UserName is Required")]
…

Syed Mohammad Fahim Abrar
- 785
- 1
- 7
- 24
1
vote
2 answers
Asp.Net Validation control conflicts with javascript function in MS Edge only
I have a user control that is used inside a form. The control contains two standard Asp.Net validation controls.
Here's the code snippet - as you can see there is a required field validator and a regular expression validator:

John Ohara
- 2,821
- 3
- 28
- 54
1
vote
2 answers
ASP.Net MVC: User must select one check box validate at client side
I have UI where i am showing 3 checkboxes and each refer to different property of model class. i am using jquery unobtrusive validation just by mvc data annotation. i want when user submit form then user has to select one checkbox otherwise client…

Mist
- 684
- 9
- 30
1
vote
1 answer
Asp.net webform with checkbox validation not working
I have a webform with 5-6 input fields with validation which was working fine & now i need to add checkboc for T&C and form should not submit unless T&C checkbox is check.
Below i part of my code for simplicity i have removed some input to keep it…

Learning
- 19,469
- 39
- 180
- 373
1
vote
1 answer
ASP.NET Validator with dynamic error text
I need some dynamic text in my validator ErrorMessage.
This is what I'm trying to do, but it doesn't work:

Kenbo
- 131
- 2
- 9
1
vote
1 answer
How to make sure validator error messages are displayed to the right?
First, take a look at the thing we can see
As you can see, at the From we have an invalid email address, while at the To we have no email address. Both fields have a RequiredFieldValidator and another validator. In the case of the From, the other…

Lajos Arpad
- 64,414
- 37
- 100
- 175
1
vote
2 answers
RegularExpressionValidator Error Message not visible
I have the following RegularExpressionValidator to allow only 4 digits number.

Nuke
- 1,169
- 5
- 16
- 33
1
vote
2 answers
Range Validator validate that date selected was within the past 3 days
I have a range Validator i use with a jquery calendar select. I want to set the minimum value to be 3 days ago with the maximum value being today (for a valid range of 3 days ago to today). How can I accomplish this?
…

Indianaadmin stopstuck
- 149
- 1
- 14
1
vote
1 answer
Validation to force user to fill all two textboxes or neither
I have two TextBox on my page, and i want when a user fill one of them i warn him to fill another textbox, i mean to force user to fill all two textboxes or neither.
How to implement this using Validators, if applicable?
I added this controll on…

pmn
- 2,176
- 6
- 29
- 56