Code Example: 1 controller and many views

Posted on 2006-04-05
Last Modified: 2010-04-16


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

Question by:TungVan
    LVL 9

    Accepted Solution

    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;

    Author Comment


    I would like an example in windows form.

    LVL 9

    Expert Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now