|
-
Sep 11th, 2015, 07:28 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Help with Validation and CustomValidaor
Hi!
I have a very simple class
Customer
which has a property
public Orders as List(of Order)
The Order class has two properties
public amount as decimal
public validateAmount as boolean
I want to create a custom attribute that when I validate an Order, I want to do something like this:
Code:
if validateAmount then
if amount < 10 then
return new ValidationResult("The amount of this order is too small")
end if
return ValidationResult.Success
end if
The problem I have is, where do I put the custom attribute? On class level or on property level?
I also want the red rectangle around the textbox, but that indicates I must place the custom validator on property level, in the Order class. But there, I have no access to the ValidateAmount property, since the context of the custom validation is the field I place it on, not the object the field is contained in?
Do you have any advice? I feel like I have tried just about any combination possible...
/H
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|