Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

Code Example: 1 controller and many views


Hi,

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

Thanks
0
TungVan
Asked:
TungVan
  • 2
1 Solution
 
pallospCommented:
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;
    }
0
 
TungVanAuthor Commented:

I would like an example in windows form.

Thanks
0
 
pallospCommented:
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.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now