public void AddToWebPartGallery(WebPartGalleryItem webPartGalleryItem) { base.AddObject("WebPartGallery", webPartGalleryItem); }
public static WebPartGalleryItem CreateWebPartGalleryItem(int ID) { WebPartGalleryItem webPartGalleryItem = new WebPartGalleryItem(); webPartGalleryItem.Id = ID; return webPartGalleryItem; }
public override void AddItemToPage(System.Web.UI.WebControls.WebParts.WebPartZoneBase zone, int zoneIndex, WebPartGalleryItem item, string wpid) { if (zone == null) { throw new ArgumentNullException("zone"); } if (item == null) { throw new ArgumentNullException("item"); } System.Web.UI.WebControls.WebParts.WebPart webPart = ((WebPartGalleryItemBase)item).Instantiate(); /* * if (!item.IsSafeAgainstScript) * { * SPWebPartManager currentWebPartManager = WebPartManager.GetCurrentWebPartManager(this.Page) as SPWebPartManager; * if (!CanUserScript(SPContext.Current.Web)) * { * currentWebPartManager.SafeForScriptingManager.ProcessAllowContributorScriptPropertiesRollback(webPart); * } * } */ if (!string.IsNullOrEmpty(wpid)) { webPart.ID = wpid; webPart.TitleIconImageUrl = webPart.CatalogIconImageUrl; webPart.ChromeType = PartChromeType.None; } this.AddItemToPage(zone, zoneIndex, webPart); }