Tagged Questions
451
votes
26answers
238k views
A potentially dangerous Request.Form value was detected from the client
Everytime a user posts something containing < or > in a page in my webapp, I get this exception thrown.
I don't want to go into the discussion about the smartness of throwing an exception or ...
0
votes
1answer
36 views
Display image in validation
I am working in ASP.Net MVC. I have to submit a form, which i can validate, only by showing error messages. But i don't want to show text in case of error, rather want to show image. Please tell me ...
3
votes
1answer
115 views
MVC form validation without form submission
I have a standard form populated by an MVC model with standard [Required] validation. I want to "submit" this form data via AJAX, not by a submit, and I would like to take advantage of the built-in ...
0
votes
1answer
54 views
Data annotation is not working with checkbox
Custom Attribute
public class BooleanMustBeTrueAttribute : ValidationAttribute
{
public override bool IsValid(object propertyValue)
{
return propertyValue != null
...
0
votes
1answer
24 views
MVC custom validation attribute
Is it possible to get HTML custom attribute (client-side) when server fire the ValidationResult.
I am doing like this
Model Class :
public class Model_Test
{
[Age(18,50)]
[Display(Name ...
0
votes
2answers
23 views
asp net mvc custom client side validation for one field
I want to the override default client side validation for only one form field.
what I did is:
$( ".txt-field" ).change( function( event )
{
if ( !checkField( $(this).val() ) )
{
...
0
votes
1answer
32 views
Prevent html tags entries in mvc textbox using regular expression
I want to prevent any html tags (written between "<>") in a textbox in my mvc 4 application.
I have given the data annotation regular expression for my property as follows:
...
0
votes
3answers
289 views
How to validate DateTime inside TextBoxFor ASP.NET MVC
I have this code:
@Html.TextBoxFor(m => Model.MyDateTime)
MyDateTime - is DateTime object.
It shows correct date and time inside textbox: 09/10/2010 05:19:56 PM
But when I try to click submit ...
0
votes
1answer
32 views
mvc custom validation min price
I have a project. And I need a custom validation for find minimum price. Now first off all my model is in here;
public class ReservationModel
{
[Required]
public DateTime BeginDate { get; ...
2
votes
1answer
66 views
Email address validation using ASP.NET MVC data type attributes
I have some problems with the validation of a Email.
In my Model:
[Required(ErrorMessage = "Field can't be empty")]
[DataType(DataType.EmailAddress, ErrorMessage = "E-mail is not valid")]
...
1
vote
1answer
39 views
Data annotations extensions validators: Is .c0m a valid TLD
I downloaded Data Annotations Extensions for .NET from Data annotations extensions for use to validate user input in an C#/ASP.NET MVC application. The library came with high commendations from the ...
1
vote
2answers
52 views
ASP.NET MVC4 Validation
I have a View model
public class TrainingProgramScheduledDateVM
{
public bool IsTuesday { get; set; }
[DataType(DataType.Time)]
public string TueStartTime { get; set; }
...
1
vote
1answer
41 views
ASP.NET MVC 4 Zip Code Validation
I am using ASP.NET MVC 4 and I am looking for a attribute for Zip Code Validation
[Required(ErrorMessage = "Zip Code is Required")]
[ZipCode]
public string ZipCode { get; set; }
I know this doesn't ...
1
vote
1answer
31 views
asp.net MVC 4 SSN Validation
I am using ASP.NET MVC 4 and I am looking for an attribute for SSN Validation.
[Required(ErrorMessage = "Social Security is Required")]
[SSN]
public string SSN { get; set; }
I know this doesn't ...
2
votes
3answers
196 views
Where to run a duplicate check for an entity
I'm looking for advice on the "best" place to put validation logic, such as a duplicate check for an entity, when using Entity Framework Code-First, in an MVC application.
To use a simple example:
...