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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:51:43+00:00 2026-06-09T11:51:43+00:00

Say I have a composite control in which I have a ListBox control which

  • 0

Say I have a composite control in which I have a ListBox control which lists, for example, employees, and another control which contains multiple TextBox controls that will contains the employee’s details.

When an employee is selected from the ListBox control, I need to pass an Employee object to the “detail” control, then assign the Text property of every TextBox control to their relative property of the Employee object.

I have two solutions to pass the Employee object to the “detail” control but I am not sure of which is the best.

Solution 1 : Expose a Employee property in the “detail” control so when an employee is selected, I could do detailControl.Employee = selectedEmployee.

Solution 2 : Expose an event in the main control and trigger it when an employee is selected. The “detail” control would subscribe to that event and receive the Employee object through the event’s eventargs.

I know that both method will work just fine. I am just unsure of what is best to use.

Some say that you should pass data between controls with custom events, that it is a best loosely-coupled approach.

Some say that implementing custom events takes more time because you have to create them, add the properties to it, etc. so going with exposed properties is faster and simpler.

What do you suggest ?

  • 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-06-09T11:51:44+00:00Added an answer on June 9, 2026 at 11:51 am

    Well, in my ideal world you would have a controller of some kind.

    The main control would raise an event to which the controller would listen. The controller would then decode who should be notified, i.e the detail control.

    This decouples the UI components entirely, providing the usual benefits, including facilitated unit testing.

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

Sidebar

Related Questions

Let's say we have a composite web control with a combobox and a textbox.
lets say i have a custom widget which has a ClickHandler. Here's the example:
If I have a master 'composite custom server control', with several child custom controls,
For the sake of the example, let's say that I have to model the
Say I have a SSI script that uses exec, or a PHP script that
I have a question about viewstate and custom controls in asp.net. Say I have
I have a strange issue: there is a SectionPart with composite, which is create
I have a business object, which is a composite of child objects. I am
Let's say I have a QString that may consist of any Unicode characters, and
I have a class based on Composite that embeds an SWT List instance. Using

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.