Source for a Custom CatalogZone This hijacks the catalogpartchrome and uses a customcatalogpartchrome but has a few other niceties as well.
/// <summary>
/// Summary description for CustomCatalogZone
/// </summary>
public class CustomCatalogZone : CatalogZone
{
// Fields
private ITemplate _zoneTemplate;
protected override CatalogPartChrome CreateCatalogPartChrome ()
{
return new CustomCatalogPartChrome ( this );
}
protected override void RaisePostBackEvent ( string eventArgument )
{
string[] textArray = eventArgument.Split ( new char[] { '$' } );
if ( ( textArray.Length == 2 ) && ( textArray[0] == "select" ) )
{
this.SelectedCatalogPartID = textArray[1];
}
else if ( string.Equals ( eventArgument, "add", StringComparison.OrdinalIgnoreCase ) )
{
if ( this.AddVerb.Visible && this.AddVerb.Enabled )
{
HttpContext.Current.Session["WebPartsAdded"] = true;
typeof ( CatalogZoneBase ).GetMethod ( "AddSelectedWebParts", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance ).Invoke ( this, new object[] { } );
this.Close ();
}
}
else if ( string.Equals ( eventArgument, "close", StringComparison.OrdinalIgnoreCase ) )
{
if ( this.CloseVerb.Visible && this.CloseVerb.Enabled )
{
this.Close ();
}
}
else
{
base.RaisePostBackEvent ( eventArgument );
}
}
protected override void Close ()
{
if ( base.WebPartManager != null )
{
base.WebPartManager.DisplayMode = WebPartManager.BrowseDisplayMode;
}
// HttpContext.Current.Response.Redirect ( "default.aspx" );
}
}