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 6328463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:27:47+00:00 2026-05-24T17:27:47+00:00

I needed a validation tool that could be reused in multiple projects, so I

  • 0

I needed a validation tool that could be reused in multiple projects, so I decided to make it a Web User Control. Below are the steps I took to set it up:

  • Created a new web project and added my Web User Control.
  • In IIS, I enabled the project as an application, and set this new project folder as a Virtual Directory in all the projects that will be using it, and enabled each Virtual Directory as an application.
  • For each project that uses the control, I added a reference to the dll, and added the control to that project’s web.config:

    <add tagPrefix="ut" src="~/UserControls/ValidateAcct.ascx" tagName="ValidateAcct" />
    

    NOTE: 'UserControls' is a Virtual Directory, and does not actually exist in each of the host projects.

  • Then I added the control to the host page:

    <ut:ValidateAcct ID="valAcct" runat="server" />
    

At runtime the content from the Web User Control displays correctly on the host page, but from the host page’s code-behind I am unable to call any of the methods I created for the Web User Control. If I instantiate the control entirely from code-behind, the methods are there. I assume this is because I am working solely from the dll, and doesn’t involve any Virtual Directory.

Another issue I am encountering is with events. I created the following event on the Web User Control, and I’d like to handle it on my host page:

    protected virtual void AccountValidated(object sender, EventArgs e) { }

Once again, from the host page’s code-behind I cannot access this event. I thought maybe I could just instantiate the control in the code-behind to access the event, like I did with the methods, but even that didn’t work.

The goal here is that I’d like this user control to be used by multiple projects within one website, but only have to maintain one copy of the control/code. This is why I went the Virtual Directory route, but I have a feeling this is the cause of all my problems. Any assistance anyone can give would be greatly appreciated!

  • 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-24T17:27:48+00:00Added an answer on May 24, 2026 at 5:27 pm

    You need to create event event handlers in the user control so that you can bubble the events up the page.

    public event EventHandler AccountValidated;
    

    As for your second problem, can you check the designer.cs file and make sure that the user control type is ValidateAcct. If it’s not ValidateAcct, and it’s just UserControl, then that’s why you can’t see any of the methods you created.

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

Sidebar

Related Questions

It seems for me that best place for validation of user input is in
I needed to find all the files that contained a specific string pattern. The
I needed a generic collection or list that can fire an event when an
I needed a Low-Pass-Filter in one of my Scala projects and came up with
I'm in the process of adding some much needed client side form validation to
I need to implement a wizardy, dynamic UI that uses complex validation of the
I have a piece of xml that contains optional non-enumerated elements, so schema validation
What configuration is needed to use annotations from javax.validation.constraints like @Size , @NotNull ,
I have a form that validates using the jQuery plugin: Validation, v1.9.0. The validation
For example, if the validation says a User must have an address (we separate

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.