|
<%@ Page language="C#" MasterPageFile="~/MasterPage.master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<asp:WebPartManager ID="WebPartManager1" runat="server" Personalization-Enabled="true" />
<ajax:ajaxpanel ID="Ajaxpanel1" runat="server">
<fieldset>
<legend>ASP.NET 2.0 WebParts demo <asp:LinkButton runat="server" id="Toggle" Text="[Switch to EditMode]" OnClick="Toggle_Click" /></legend>
<i>Very cool demo of ASP.NET 2.0 WebParts running on MagicAjax.<br />Switch to EditMode and move/add/delete WebParts without a visible postback.<br />
Note: Your modifications are stored in Session, so will be lost when you leave this site.<br />
Note2: Dragging and dropping of WebParts is a ASP.NET 2.0 feature that is only supported for IE.</i><br /><br />
<table width="100%"><tr><td valign="top" width="30%">
<asp:WebPartZone runat="server" ID="WebPartZone1" Width="100%">
<PartTitleStyle CssClass="WebPartTitle" BackColor="LightBlue" />
<ZoneTemplate>
<uc1:Logo ID="Logo1" runat="server" />
</ZoneTemplate>
</asp:WebPartZone>
</td><td valign="top" width="30%">
<asp:WebPartZone runat="server" ID="WebPartZone2" Width="100%">
<PartTitleStyle CssClass="WebPartTitle" BackColor="LightBlue" />
<ZoneTemplate>
<uc1:Calendar ID="Calendar1" runat="server" />
</ZoneTemplate>
</asp:WebPartZone>
</td><td width="10%">
</td><td valign="top" width="30%">
<asp:CatalogZone ID="CatalogZone1" runat="server">
<HeaderStyle BackColor="Khaki" />
<FooterStyle BackColor="Khaki" />
<CloseVerb Visible="false" />
<HeaderCloseVerb Visible="false" />
<ZoneTemplate>
<asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" runat="server" Title="Catalog">
<WebPartsTemplate>
<uc1:Logo ID="Logo1" runat="server" />
<uc1:Calendar ID="Calendar1" runat="server" />
</WebPartsTemplate>
</asp:DeclarativeCatalogPart>
</ZoneTemplate>
</asp:CatalogZone>
</td></tr></table>
</fieldset>
</ajax:ajaxpanel>
</asp:Content>
<script language="C#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Force setting of Session id (workaround for bug in MagicAjax)
Session["dummy"] = "dummy";
// Authenticate user with dummy userName, so the WebPartManager will allow
// switching to Editmode.
FormsAuthentication.SetAuthCookie("dummy", false);
}
}
protected void Toggle_Click(object sender, EventArgs e)
{
if (WebPartManager1.DisplayMode == WebPartManager.BrowseDisplayMode)
{
Toggle.Text = "[Switch to ViewMode]";
WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
}
else
{
Toggle.Text = "[Switch to EditMode]";
WebPartManager1.DisplayMode = WebPartManager.BrowseDisplayMode;
}
}
</script>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.