Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4382604
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T12:48:00+00:00 2026-05-21T12:48:00+00:00

I am using the Validationprovider control for the 1st time. I’ve had limited success

  • 0

I am using the Validationprovider control for the 1st time. I’ve had limited success trying to mimic the functionality t hat I saw in the ValidationQuickStart solution example that comes with the Ent Lib installation.

While I was able to get form errorprovider icons to appear based on Business Object validations that decorate the BO property with validation attribute such as:

<NotNullValidator(MessageTemplate:="Gender must be specified.", RuleSet:="MyRule", Tag:="Gender")> _
      Public Shadows Property Gender() As String
        Get
            Return MyBase.Gender
        End Get
        Set(ByVal value As String)
            MyBase.Gender = value
        End Set
    End Property

However, if I wanted to add an edit to the “SelfValidation” method, how would I tie the Result to a form control?

(In Self Validation)

If Me.Attornet s Nothing Then
    Dim result As New ValidationResult("Attorney selection is required", Me, Nothing, Nothing, Nothing)
    results.AddResult(result)
End If

Or must I create by own **CUSTOM VALIDATOR?” and then use its type to decorate a Business Object property?

Edit:

If The ValidationProvider control is not intended for cross-control validation like this one:

if the user selects the “Yes” option in the radio button group corresponding to Business Option property Customer.DoYouSmokeCrack As Boolean then the txtHowMuch control should be flagged with an ErrorProvider icon indicating that this field is conditionally required.

The way I am doing this now is to do this in a Self Validation block and, when I add a ValidationResult object to the collection, I set the Key property to “Explanation” so the GUI can use it to manually map to the offending screen control.

Is there a more standard/beter way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T12:48:01+00:00Added an answer on May 21, 2026 at 12:48 pm

    You can’t use self validation (or any other cross property validation) using the ValidationProvider. It won’t work, because the ValidationProvider works without the existence of an business object. What it does is loading all validations defined for a single property and check the value of the given control using those validations.

    Cross property validations such as what custom validators and self validation do need a completely initialized business object to work.

    If the validation is simple and validates a single property (without doing anything else as going to the database etc), you can write a custom validation attribute to do the validation. In all other cases, what you should do is create the business object after the user hit “Save” (what you will probably be doing anyway) and validate the object at that point. In other words, you delay the validation till the user commits his changes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using online interfaces to a version control system is a nice way to have
Using C# .NET 3.5 and WCF, I'm trying to write out some of the
Using PHP, I'm trying to give each specific text its own variable. I believe
I'm trying to build a C++ extension for python using swig. I've followed the
Using XSLT 1.0, I'm trying to essentially create a small node set and then
I'm having a hard time with StructureMap configuration. I have a ValidationProvider that accepts
Using jQuery UI Resizable I'm trying to prevent resizing based on various rules. The
Using PyObjC , you can use Python to write Cocoa applications for OS X.
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.