12.2. Building a Web Parts Page without AJAX

As you begin using the Portal Framework to build Web sites, note that the framework defines everything in zones. There are zones for laying out as well as for editing content. The zones that a page might incorporate are managed by a Portal Framework manager. The Portal Framework manager performs the management on your behalf, meaning that you do not have to manage them yourself in any fashion. This makes working with the Portal Framework a breeze.

This framework contains a lot of moving parts, and these multiple pieces that are heavily dependent upon each other. For this reason, this section starts by examining a simple page built with a couple of Web Parts. This page is presented in Listing 12-1.

Example 12-1. A simple page using Web Parts without AJAX
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.UI.WebControls.WebParts"%>
<%@ Register src="HelloUser.ascx" tagname="HelloUser" tagprefix="uc1" %>

<script runat="server">

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!Page.IsPostBack)
        {
            WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
        }
    }

    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        Label1.Text = "You selected " + Calendar1.SelectedDate.ToShortDateString();
    }

    protected void LinkButtonBrowse_Click(object sender, EventArgs e)
    {
        WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
    }

    protected void LinkButtonDesign_Click(object sender, EventArgs e)
{ WebPartManager1.DisplayMode ...

Get Professional ASP.NET 3.5 AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.