Export (0) Print
Expand All

PropertyGridEditorPart.ApplyChanges Method

Saves the values from a PropertyGridEditorPart control to the corresponding properties in the associated WebPart control.

Namespace:  System.Web.UI.WebControls.WebParts
Assembly:  System.Web (in System.Web.dll)

public override bool ApplyChanges()

Return Value

Type: System.Boolean
true if the action of saving values from the PropertyGridEditorPart to the WebPart is successful; otherwise (if an error occurs), false.

ExceptionCondition
Exception

An error occurred when trying to set the value for a property on the associated WebPart.

The ApplyChanges method is a critical method on a PropertyGridEditorPart control. The method saves the values a user has set on a PropertyGridEditorPart control to the corresponding properties in the associated WebPart control. The associated control is referenced in the PropertyGridEditorPart control's inherited WebPartToEdit property.

Important noteImportant

You cannot override the ApplyChanges method because the PropertyGridEditorPart type is sealed to prevent inheriting from it. However, if you need more programmatic control over the process of editing various WebPart control properties than the PropertyGridEditorPart control provides, you can create a custom EditorPart control and provide your own implementation of this method. For a code example, see the ApplyChanges method.

The ApplyChanges method attempts to set the values on public custom properties in the associated WebPart control, provided that those properties each have a [WebBrowsable(true)] attribute.

The ApplyChanges method is called when the user clicks a button representing an OK or an apply verb in the editing user interface (UI). You can also call it directly from your own code if there is a need to save the edited values apart from user actions.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft