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

MVC validation with JQuery.Ajax

i am trying to validate a form in a JQuery model dialog that is dynamically loading a view generated from a jquery ajax call there is already one form on the page and this form is being created under the other form, and everything seems to be…
0
votes
2 answers

Partial class for data validation in asp.net MVC2

I am creating my first ASP.NET MVC2 application. I am trying to create a Partial Class for data validation as demonstrated in the nerdDinner application, but MetaDataType has a red line with the message : "The type or namespace 'MetadataType' could…
0
votes
2 answers

ASP.NET MVC - Why is ModelState.IsValid returning true after I set ModelMetadata.IsRequired programmatically?

I have got an extension method which I call from within my EditorTemplate (for a string) which sets the Label and the Required metadata on the on the control. (I cannot annotate my models so this is why I am doing this). public static void…
0
votes
1 answer

ViewModel not matching model causes modelstate to be invalid

I have a model class like this: class Person { string FirstName, string LastName, string ID } When I send the model to the browser via a GET, I send the data as a composite of two fields (e.g. FirstName.ToString() + LastName.ToString())…
Dan
  • 1,222
  • 2
  • 17
  • 33
0
votes
1 answer

Changing the underlying model that ModelState is validating against

I am pushing out a larger model to a view, but wanting to update only parts of that view, that has multiple partial views for a List. Essentially, I have the code to update the original model, but want to have the ModelState.IsValid operate against…
Tracker1
  • 19,103
  • 12
  • 80
  • 106
0
votes
1 answer

How to deal with postbacks from multiple strongly-typed submit-able partial views on one view?

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/MasterPage.Master" Inherits="System.Web.Mvc.ViewPage" %> LoginPage
0
votes
1 answer

ASP.NET C# MVC 2 Web App: PropertiesMustMatch?

For some reason, PropertiesMustMatch has absolutely no effect. Do I need to make some other connection beyond what the project built for me? Also, by adding a new PropertiesMustMatch bind for ConfirmEmail, that also has no effect. Any ideas?
dcolumbus
  • 9,596
  • 26
  • 100
  • 165
0
votes
1 answer

MVC 2 Model Validation messages

i have a view model with a property like this one : [RegularExpression(@"^d\+$", ErrorMessageResourceType = typeof(Resources.Validation), ErrorMessageResourceName = "NumberValidationMsg" )] public int? Number {get; set;} NumberValidationMsg…
shkipper
  • 1,403
  • 3
  • 21
  • 35
0
votes
1 answer

In Asp.net 2.0 how to retain data in the controls in view while redisplaying same view with the validation error message

I want to retain data in the view controls like drop down list, radio button, checkbox, textbox while displaying same view again with validation fail message. Data is in the drop down list bind using the ViewData. Check box data bind using viewdata.…
TSara
  • 11
  • 1
  • 1
  • 3
0
votes
1 answer

How can I make ASP.NET MVC 2 persist submitted form values across multiple submits?

Say I have a strongly-typed view of ViewPage and some additional fields in the form of create/edit scenarios that are not directly part of the Song entity (because I have to do some parsing before I fetch the composers from a foreign table and…
randomguy
  • 12,042
  • 16
  • 71
  • 101
0
votes
1 answer

How come module-level validators are evaluated only after property-level validators?

I'm using the module-level validator: 'PropertiesMustMatch' on my view-model, like so: [PropertiesMustMatch("Password", "PasswordConfirm")] public class HomeIndex { [Required] public string Name { get; set; } public string Password {…
Jonathan
  • 32,202
  • 38
  • 137
  • 208
0
votes
2 answers

asp.net mvc 2 validating text inputs on modal windows

i am tasked with the job of creating client-side validation on a form in an asp.net MVC 2 application, which has a modal window (the modal exists as part of the wrapping form, it is not a form unto itself). how would i go about providing validation…
0
votes
1 answer

Dynamic client side validation

Is anyone doing dynamic client validation and if so how are you doing it. I have a view where client side validation is enabled through jquery validator ( see below)
Noel
  • 5,037
  • 9
  • 46
  • 69
0
votes
1 answer

MVC: On partial page start validation from JS without postback

How do I start validation from the client/javascript using the MS MVC Validation library? Using MS ASP.Net MVC, I have a page with a PartialView in a modal dialog (change password). When the user selects 'save', I need to validate this on the…
0
votes
2 answers

ASP.NET MVC 2 JQuery POST not displaying the model state errors

I have been using asp.net mvc for a bit (but I'm still a beginer). I want to have the ability to update two views as a result of a jquery postback. Basically I have a list and a details view. The details view is presented using a jquery popup…
Oshan
  • 1
  • 1