This post originated from an RSS feed registered with .NET Buzz
by Sean McCormack.
Original Post: WebPartPageMenu control is not in Beta2?!?
Feed Title: Vini Vidi Vici - Sean McCormack's Blog
Feed URL: http://smccormack.blogs.com/adapdev/SyndicationService.asmx/GetRss
Feed Description: Sean McCormack's Blog, focusing on various aspects of .NET development, open source projects, recommended books and tools
I've been playing with the Beta2, going through ASP.NET
2.0 - The Beta Version when I came across a great sample on WebParts.
Unfortunately, I hit a small snag though when trying the following code:
The WebPartPageMenu control provides a nice dropdown list of functions, such as browsing
the catalog of WebParts, changing layouts, etc. Here's an example:
Turns out, WebPartPageMenu is no longer in Beta2!! You now
have to do something like this:
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls;
public partial class _Default
: System.Web.UI.Page
{
protectedvoid Page_Load(object sender,
EventArgs e)
{
this.WebPartManager1.DisplayMode = WebPartManager.CatalogDisplayMode;
}
}
The WebPartManager class provides several options, such as EditDisplayMode, BrowseDisplayMode,
etc. Not pretty. Looks like you essentially have to write from scratch
what used to be available with the WebPartPageMenu?? Does anyone know if there
are plans for a replacement or similar control in the final release??
Here's the Beta2 change information:
WebPartPageMenu Control
This control provided a convenient mechanism for switching page personalization modes
in pages using the web parts control set. The UI generated by this control is a dropdown
list or menu similar to Sharepoint. However, pages often require more flexibility
for switching modes than this control provides, and the WebPartManager class makes
it easy to programmatically switch personalization mode from any server control.
To switch modes, you can use an interactive server control such as a Button, LinkButton,
or DropDownList, and write an event handler for it that programmatically switches
the personalization mode. For example, the following code will switch the personalization
mode of a WebPartManager: