/// <devdoc> /// This method allows a non-WebPart control to mark its personalization as dirty. /// </devdoc> public static void SetPersonalizationDirty(Control control) { if (control == null) { throw new ArgumentNullException("control"); } if (control.Page == null) { throw new ArgumentException(SR.GetString(SR.PropertyCannotBeNull, "Page"), "control"); } WebPartManager wpm = WebPartManager.GetCurrentWebPartManager(control.Page); if (wpm == null) { throw new InvalidOperationException(SR.GetString(SR.WebPartManagerRequired)); } WebPart webPart = wpm.GetGenericWebPart(control); if (webPart == null) { throw new ArgumentException(SR.GetString(SR.WebPart_NonWebPart), "control"); } webPart.SetPersonalizationDirty(); }
public static void SetPersonalizationDirty(Control control) { if (control == null) { throw new ArgumentNullException("control"); } if (control.Page == null) { throw new ArgumentException(System.Web.SR.GetString("PropertyCannotBeNull", new object[] { "Page" }), "control"); } System.Web.UI.WebControls.WebParts.WebPartManager currentWebPartManager = System.Web.UI.WebControls.WebParts.WebPartManager.GetCurrentWebPartManager(control.Page); if (currentWebPartManager == null) { throw new InvalidOperationException(System.Web.SR.GetString("WebPartManagerRequired")); } WebPart genericWebPart = currentWebPartManager.GetGenericWebPart(control); if (genericWebPart == null) { throw new ArgumentException(System.Web.SR.GetString("WebPart_NonWebPart"), "control"); } genericWebPart.SetPersonalizationDirty(); }