Goals:

Steps:

  1. Create a new ASP.NET Web Application project in Visual Studio.
  2. In this tutorial we will create a web page containing a header and 3 customizable columns. Create a layout of the page, e.g. using tables:

    The code:
    <table cellpadding="5" style="width: 100%; vertical-align: top;">
        <tr>
            <td colspan="3" class="header">
                Header
            
    </td>
        </tr>
        <tr>
            <td class="column">
                1st column
            
    </td>
            <td class="column">
                2nd column
            
    </td>
            <td class="column">
                3rd column
            
    </td>
        </tr>
    </
    table>
    CSS styles:
    .header
    {
        
    text-align: center;
        
    background-color: #CCCCFF;
    }

    .column
    {
        
    vertical-align: top;
        
    width: 33%;
        
    background-color: #CCFFCC;
    }
  3. Add a WebPartManager control to the page. Add also 3 WebPartZone controls, one per column. The WebPartManager must be inserted to the markup code before all WebPartZone.
  4. Add some content to the columns: web server controls, user controls, custom controls, HTML server controls, row text, or HTML elements:

    Take a look at the result:

    To get rid of these ugly 'Untitled [#]' text, the source code of the page must be manually modified in the Code view. Add a Title property with desired text for each control:
  5. It is time to allow the user to modify the layout (change places of controls, hide or show them, and even modify some of their properties) now. Web Parts are based on modes. The current mode allows only viewing Web Parts without possibility to make any modifications.
  6. It is time to understand how Web Parts are connected with personalization. Web Parts will allow the user to make any changes in their layout only if there will be a mechanism for storing these changes. The personalization is such mechanism, so if we want to give the user possibility to modify the page's content, the personalization must be enabled.
  7. See the Design mode.
  8. The user can close a control using the Close link, but he cannot show a hidden control. To allow him to do this, additional Web Parts controls must be added to the page.
  9. The last mode is Edit.

[Source code]