<%@ Page Language="C#"%>
<%@ Register Src="DailyLinks.ascx" TagName="DailyLinks" TagPrefix="uc1" %>

<script runat="server">
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
      WebParts.WebPartDisplayMode wpDisplayMode =
     Webpartmanager1.SupportedDisplayModes[DropDownList1.SelectedValue.ToString()];
      Webpartmanager1.DisplayMode = wpDisplayMode;
    }

    protected void Page_Init(object sender, EventArgs e)
    {
      foreach (WebPartDisplayMode wpMode in 
         Webpartmanager1.SupportedDisplayModes)
      {            
            string modeName = wpMode.Name;
            ListItem dd_ListItem = new ListItem(modeName, modeName);
            DropDownList1.Items.Add(dd_ListItem);
      }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Web Parts Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:WebPartManager ID="Webpartmanager1" Runat="server">
        </asp:WebPartManager>
        <table cellpadding="5" border="1">
            <tr>
                <td colspan="2">
                    <h1>Bill Evjen's Web Page</h1>
                    <asp:WebPartZone ID="WebPartZone1" Runat="server" 
                     LayoutOrientation="Horizontal">
                        <ZoneTemplate>
                            <asp:Label ID="Label1" Runat="server" Text="Label" 
                             Title="Welcome to my web page!">
                             Welcome to the page!
                            </asp:Label>
                        </ZoneTemplate>
                    </asp:WebPartZone>
                </td>
                <td valign="top">
                    Select mode:
                    <asp:DropDownList ID="DropDownList1" runat="server" 
                     AutoPostBack="True" 
                     OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">        
                    </asp:DropDownList>
                </td>
            </tr>
            <tr valign="top">
                <td>
                    <asp:WebPartZone ID="WebPartZone2" Runat="server">
                        <ZoneTemplate>
                            <asp:Image ID="Image1" Runat="server" 
                             ImageUrl="~/Images/Tuija.jpg" Width="150px" 
                             Title="Tuija at the Museum">
                            </asp:Image>
                            <uc1:DailyLinks ID="DailyLinks1" runat="server" 
                             Title="Daily Links">
                            </uc1:DailyLinks>
                        </ZoneTemplate>
                    </asp:WebPartZone>
                </td>
                <td>
                    <asp:WebPartZone ID="WebPartZone3" Runat="server">
                        <ZoneTemplate>
                            <asp:Calendar ID="Calendar1" Runat="server"
                             Title="Calendar">
                            </asp:Calendar>
                        </ZoneTemplate>
                    </asp:WebPartZone>
                </td>
                <td><!-- Blank for now -->
                </td>
            </tr>
        </table>        
    </form>
</body>
</html>
