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
3
votes
2 answers

ASP.Net MVC 2 Controller's TryValidate doesn't validate the List<> items within the model

How do you get a model's validation to also validate child objects in a generic list property. I have a model that I'm trying to validate, this is not what's being posted to the server, but a composite of some information posted, and information…
Tracker1
  • 17,841
  • 10
  • 75
  • 104
3
votes
2 answers

Detect if asp.net mvc2 client side validation passes or fails

All... I am working in a asp.net mvc2 project using MicrosoftMvcValidation... I have some custom javascript that I need to run when a form gets posted... I am currently running this code when the submit button is clicked. However, when the client…
Todd
  • 1,401
  • 1
  • 13
  • 27
3
votes
0 answers

MVC: Client Validation Fails, but data is still posted

As above, I'm implemented the client side validation no problem, and it pops up the relevant messages as required. However, the submit button still appears to submit the form even though the form is not in a valid state. The controller method…
Gavin
  • 2,311
  • 3
  • 19
  • 20
3
votes
2 answers

Handling 'A potentially dangerous Request.Form value was detected from the client'

I am trying to figure out how to handle this error. A potentially dangerous Request.Form value was detected from the client The error occurs when a user enters in html or xml tags(

or ) and tries to submit a form. The input is not…

Mikael
  • 95
  • 1
  • 2
  • 7
3
votes
1 answer

ASP MVC2 model binding issue on POST with strongly-typed HTML helpers

So I'm looking at moving from MVC 1.0 to MVC 2.0 RTM. One of the conventions I'd like to start following is using the strongly-typed HTML helpers for generating controls like text boxes. However, it looks like it won't be an easy jump. I tried…
3
votes
1 answer

Client-side validation with a model-less view in ASP.NET MVC 2

I'd like to use the new client side validation features in MVC 2 but I have a particular view that just has a couple textboxes on it and I don't want to create a strongly typed model for it. Can someone describe how to leverage the validation…
James Alexander
  • 5,718
  • 10
  • 40
  • 52
3
votes
2 answers

ASP.NET MVC 2 client-side validation rules not being created

MVC isn't generating the client-side validation rules for my viewmodel. The HTML just contains this: