Makes the associated input control a required field.
Questions tagged [requiredfieldvalidator]
510 questions
96
votes
12 answers
Conditionally required property using data annotations
I have a class like this:
public class Document
{
public int DocumentType{get;set;}
[Required]
public string Name{get;set;}
[Required]
public string Name2{get;set;}
}
Now if I put a [Required] data annotation on the Name and Name2…

brtb
- 2,201
- 6
- 34
- 53
69
votes
4 answers
How to add a RequiredFieldValidator to DropDownList control?
I have a DropDownList binded with aSqlDataSource to display the values from the database.
I am unable to validate using a RequiredFieldValidator.

user242375
- 691
- 1
- 6
- 5
38
votes
7 answers
Dynamically enable or disable RequiredFieldValidator based on value of DropDownList
I have an ASP.NET form with three text inputs, one each for "Work Phone", "Home Phone" and "Cell Phone". Each of these text inputs has a RequiredFieldValidator associated with it. I also have a DropDownList where the user can select the preferred…

Jeremy
- 9,307
- 3
- 21
- 17
36
votes
4 answers
Dropdownlist validation in Asp.net Using Required field validator
I have Dropdownlist whose value field and text field are bind at runtime.
it has --select-- as first item with a value of 0
and the rest of the values are bind at runtime.
I have given validaton group for both the control and the validator as…

Anand Kumar M
- 728
- 3
- 12
- 25
31
votes
4 answers
Bypass HTML "required" attribute when submitting
I use required for a 1st check before submitting a form.
Problem is,…

Horst Walter
- 13,663
- 32
- 126
- 228
25
votes
6 answers
Hide unnecessary space when validation error messages are not firing in ASP page
I want to validate some text boxes in my ASP.NET page using ASP required field validation. And I want to display that error message in top of the page.
User Input | |
…
![]()
devan
24
votes
4 answers
Require validation only if the field is visibleI am using the [Required] attribute for the client-side validation in ASP.NET MVC 3.
The class looks as:
public class User
{
[Required(ErrorMessage = "First Name is required")]
public string FirstName { get; set; }
}
I want the field…
![]()
Prasad
24
votes
17 answers
Change Text Box Color using Required Field Validator. No Extender Controls PleaseI need to change color of TextBox whenever its required field validator is fired on Clicking the Submit button
Badmate
19
votes
4 answers
How to set form input required attribute in laravel 4I'm using the laravel framework for a project, and I'm implementing a basic form page, where I require certain values to be required, something that can be done very easily in HTML5.
In laravel, without the…
![]()
GothamCityRises
16
votes
1 answer
How to turn required field validator off when selecting cancel buttonI have a problem where my page has a required field validator, but I also want to use a 'cancel'
button which will take the user back to the menu page using response.redirect("default.aspx");
Problem is the field validator keeps firing when you…
![]()
wubblyjuggly
14
votes
4 answers
Field validation of a single button onlyI have the following validator on a textbox inside a modal dialog box.
![]()
Björn Lindqvist
13
votes
4 answers
Enable/Disable asp:validators using jqueryI am working with a wizard, where the user can sign up. There is a asp:RadioButtonList with two options, and some of the input fields in the wizard changes when the radiobutton changes. On each field there is some asp:Validators…
![]()
Thomas
13
votes
1 answer
Required field validator not working when OnClientClick is added in the buttonhi i have a RequiredFieldValidator Like this
![]()
Vishweshwar Kapse
11
votes
9 answers
how to display only single message for multiple RequiredFieldValidators?how to display only single message for multiple RequiredFieldValidator instead of individual message for RequiredFieldValidator ?
i want to as shown in following image..
my view is..
![]()
Rohan
|