We help IT Professionals succeed at work.

Code Example: 1 controller and many views

TungVan asked
Medium Priority
Last Modified: 2010-04-16


I would like to have a large project code example that shows interaction between 1 controller and many views.

Watch Question

Is the technology used in the project Windows Forms or Web Forms?

For example, in ASP.NET

1. Create a MultiView control
2. Drag&drop View controls inside it
3. Create a DropDownList, and fill with the names of the views
4. In the SelectedIndexChanged event handler of the dropdownlist write the following code:

    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) {
        MultiView1.ActiveViewIndex = DropDownList1.SelectedIndex;

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts



I would like an example in windows form.


It's a bit more complicated in Windows Forms unless you use TabControl.

You may create every view on a different Panel, move every Panel to the same position, and change their "Visible" property false. When the user selects another view, the proper Panel should be displayed.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.