Questions tagged [ivalidatableobject]
40 questions
0
votes
1 answer
asp.net mvc problem in IValidatableObject method on validation
I am creating a web app in asp.net mvc-5,
I am using IValidatableObject interface for validations,
here is how my model looks,
public class LicenseInfo : IValidatableObject
{
public int LicenseId { get; set; }
//other properties
public…

Ibrahim Shaikh
- 388
- 2
- 18
0
votes
1 answer
How to check is Role in Roles list?
I need to ckeck if Role is in Roles list collection, if isnt, throw validation result. How can i compare this or how can i solve this other way?
public class UserViewModel:IValidatableObject
{
[Required]
public string Username { get; set; }
…

Dodsonnn
- 65
- 1
- 11
0
votes
0 answers
ASP.NET MVC Custom Client-side Model Validation (compare two int values) with ivalidatableobject
I have custom validation comparing two values in my model. The server-side validation is functioning correctly.
However, I'm wondering what I need to add to get the custom model validation to work client-side (i.e. show the little red error…

Taraz
- 1,242
- 13
- 13
0
votes
0 answers
IValidatableObject not validating length of 3 inputs
I've failed for quite some time trying to figure this out. I am trying to prompt the user for the area code, suffix, and prefix of a phone number. The phone number is only valid if it's at least 7 digits, but no more than 10. I have tried the…

thatdude
- 77
- 1
- 2
- 10
0
votes
2 answers
Best way to implement a Require validation if another field is not null
I have the following two fields inside my view:-
@Html.DisplayNameFor(model=>model.Firewall.ConsoleServerID)
@Html.DropDownListFor(model =>model.Firewall.ConsoleServerID,…

John John
- 1
- 72
- 238
- 501
0
votes
0 answers
Writing Service method Versus writing an Ivalidatable object
I am working on an asp.net mvc web application, and we have to check if the user enter an IP And/OR Mac address which already exists. Currently I am checking this by writing the following service methods inside my POST Create & Edit action methods…

John John
- 1
- 72
- 238
- 501
0
votes
1 answer
@Html.BeginCollectionItem with IValidatableObject and MemberName mismatch
While using @Html.BeginCollectionItem helper by Steven Sanderson I'm trying to validate the collection items on the server side using the IValidatableObject interface.
I want to prevent the user from selecting two equal items. So for example, given…

Leniel Maccaferri
- 100,159
- 46
- 371
- 480
0
votes
3 answers
How to use IValidatableObject on Partial View
I can't seem to figure out how to validate the pieces of a partial view for an ViewModel that has the partial ViewModel as a child object. Here's my lowest level piece, which will ALWAYS be consumed as a partial view inside other form…

Graham
- 3,217
- 1
- 27
- 29
0
votes
1 answer
Unable to post a form due to ValidationSummary errors on form fields that are hidden dynamically through javaScript.
ASP.NET MVC 3 application.
I am trying to post form that has some dynamic fields which appear and disappear using JavaScript. I am using IValidatableObject for doing server side validation on some of these dynamic fields.
When these fields are…

Kanav Punj
- 1
- 1
-1
votes
1 answer
asp.net mvc Add ModelState error using IValidatableObject
I saw this nice blog that describes adding conditional validation to a asp.net mvc viewmodel. However I'm not sure how the validation error is added/bound to the specific model's property. I would like the error message to be added to my normal…

RayLoveless
- 19,880
- 21
- 76
- 94