asp.net-mvc-validation Questions
5
Solved
I'm using ASP.NET MVC 3 code-first and I have added validation data annotations to my models. Here's an example model:
public class Product
{
public int ProductId { get; set; }
[Required(ErrorM...
Ministerial asked 15/6, 2011 at 15:18
4
Solved
I'm messing around with data annotations. When I click on a link to go to a page, the validation messages are being displayed, but I would like to have the validation messages not show unless data ...
Saccharin asked 22/1, 2014 at 23:27
4
Solved
Say you have a standard ValidationSummary:
<%: Html.ValidationSummary(excludePropertyErrors: true) %>
If the ModelState contains model errors for properties but not for the model itself th...
Siren asked 3/10, 2010 at 11:29
4
Solved
I have an ASP.net MVC model with a date:
public class EditModel
{
[Display(Name="DOB")]
public DateTime? DateOfBirth { get; set; }
}
@Html.TextBoxFor(m => m.DateOfBirth)
@Html.ValidationMes...
Merth asked 28/9, 2011 at 16:6
5
Solved
I have got a hidden field with a validation for it as below
@Html.HiddenFor(m => m.Rating)
@Html.ValidationMessageFor(m => m.Rating)
The Rating property has Range validator attribute appli...
Alpine asked 17/10, 2011 at 7:15
1
Solved
I'm trying to inherit the RegularExpressionAttribute to improve reusability with validating SSNs.
I have the following model:
public class FooModel
{
[RegularExpression(@"^(?!000)(?!666)(?!9[0-9...
Footboy asked 6/9, 2013 at 21:25
2
Solved
I have a RangeValidator on a property in my model to only allow Integers that are between 0 and 100. I have a partial view that displays a form to update the property via a jQuery UI dialog. I have...
Martyrdom asked 12/3, 2013 at 19:49
1
Solved
I have an ASP.NET MVC 4 App that uses the jQuery.validation.js plugin and MVC's jQuery.validation.unobtrusive.js. I use data annotations on my view model to validate a textbox's input to be an inte...
Tread asked 19/4, 2013 at 12:57
4
Solved
I am using a form to upload a file. I want only PDF files to be uploaded. This is my code:
A input box to allow the user to choose a file:
@Html.FileBox(m => m.FileName, new { id = "FileName",...
Autoplasty asked 8/5, 2012 at 10:36
1
Solved
Working on a MVC 3 application.
I need to add a class to the validation message html. I mean for span tag.
My Model
[Required(ErrorMessage = "Role Name is required")]
[RegularExpression(@"^[a-...
Walther asked 9/1, 2013 at 7:4
3
Solved
I have a class user which looks like this:
public class User
{
public int UserId { get; set; }
[Required(ErrorMessage = "A username is required.")]
[StringLength(20, ErrorMessage = "Your usern...
Herschelherself asked 16/2, 2011 at 23:51
1
Solved
I have a two step form process where the first set of data is stored in session.
[IsMp4File]
[Required(ErrorMessage = "* Please select a video to upload")]
public HttpPostedFileBase VideoClip { ge...
Bern asked 20/12, 2011 at 11:11
2
Solved
I'm trying to solve a "A potentially dangerous Request.Form value was detected from the client" problem, and SO answers and Scott Hanselman recommend setting
<httpRuntime requestValidationMode...
Slurry asked 1/6, 2011 at 19:23
1
Solved
A weird thing keeps happening on one of my ASP.NET MVC 3 apps.
I am fetching insert rows via jQuery Ajax api and there is no problem with that. But when I get the necessary partial view back, it i...
Ferraro asked 15/11, 2011 at 13:54
2
Solved
I have the following view in ASP.net MVC 3:
@model Models.CreateProjectViewModel
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<sc...
Spavined asked 4/10, 2011 at 17:12
4
Solved
I'd like to create a custom validation attribute for MVC2 for an email address that doesn't inherit from RegularExpressionAttribute but that can be used in client validation. Can anyone point me in...
Piperidine asked 5/3, 2010 at 0:8
5
Solved
I can't seem to get any client side validation working on a MVC 2 RC app.
My model has the following:
public class ExampleModel
{
[Required(ErrorMessage="Test1 is required")]
[DisplayName("Test...
Ishii asked 4/1, 2010 at 2:55
2
Solved
How can I return a list/array of all keys that have an error?
I have tried to do the below, but it says I can't have that sort of expression for some reason.
ModelState.ToList(item => item.Val...
Mumble asked 20/5, 2009 at 15:11
1
© 2022 - 2024 — McMap. All rights reserved.