Questions tagged [asp.net-mvc-2-validation]

The ASP.NET MVC 2 modelstate validation checks if a model is valid. You can define a correct model state and check if the users input matches that validation.

80 questions
1
vote
2 answers

ASP.net validation: why do my DateTime fields also flag up as required?

I'm implementing validation in my web app... the problem is it seems to be over-validating?! The controller code looks like: [HttpPost] [Authentication] public ActionResult Create([Bind(Exclude = "Id")] CaseInfo caseInfo) { if…
laura
  • 2,951
  • 9
  • 44
  • 61
1
vote
1 answer

asp.net mvc2 validations

I am using DataAnnotations for validation (including client side) I have a form with multiple fields. Basic validation for individual fields work fine. Now there are a couple of fields of which atleast one needs to have a value (if there are 3…
byte
  • 1,665
  • 1
  • 19
  • 36
1
vote
1 answer

Why do i get input-validation-error class on a textbox because i don't have that class in the whole project?

I have something like this <%using (Html.BeginForm("X", "Y", FormMethod.Post, new { id="Z" })) { %> …
gigi
  • 3,846
  • 7
  • 37
  • 50
1
vote
2 answers

ASP.NET MVC: Image upload validation

I'm trying to subclass ValidationAttribute in ASP.NET MVC 2 to make something along the lines of an ImageValidator class which would make sure that an uploaded image (from ) has the correct mimetype, doesn't exceed the maximum…
Deniz Dogan
  • 25,711
  • 35
  • 110
  • 162
1
vote
2 answers

Asp.Net MVC 2 - Weird behavior: RedirectToAction and ValidationSummary not working

I've been working with MVC 2 for awhile and ive done ReturnToAction as well as ValidationSummary - but this is a little different in that my "submit" buttons are controls by javascript/JQuery - i debug the action and it does go into the correct…
Jerrold
  • 1,534
  • 6
  • 25
  • 43
1
vote
1 answer

ASP.NET MVC 2, Validation, Localization, Argument List possible?

I want to localize the error message for wrong user inputs. E.g. min. length of City name is 2 chars. [Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(Validation))] [StringLength(50, ErrorMessageResourceName =…
sde
  • 123
  • 1
  • 5
1
vote
1 answer

MVC2 ValidationSummary and Client side Validation

I want to have the ValidationSummary errors displayed during Client Side validation. Currently the validation messages are only appears next to the field during client side validation. I…
Spock
  • 7,009
  • 1
  • 41
  • 60
1
vote
1 answer

ASP.NET MVC 2.0 Validation and ErrorMessages

I need to set the ErrorMessage property of the DataAnnotation's validation attribute in MVC 2.0. For example I should be able to pass an ID instead of the actual error message for the Model property, for example... [StringLength(2, ErrorMessage =…
Spock
  • 7,009
  • 1
  • 41
  • 60
1
vote
1 answer

Globalization for ASP.NET MVC 2 Validators

Is there anyway to override the custom validation error messages from the ValidationAttributes? Basically I need the ValidationAttributes to support globalization.
Raphael
  • 7,972
  • 14
  • 62
  • 83
1
vote
1 answer

Mvc2 validation summary and required metadata

source code... Thing is, if i specify required metadata using fluent modelmetadata provider like this=> public class Foo { public string Bar { get; set; } } public class FooModelMetadataConfiguration :…
Arnis Lapsa
  • 45,880
  • 29
  • 115
  • 195
1
vote
2 answers

insert select tag selected value to database using storedprocedure

In my view my select tag is like this:
Nr.: