Export (0) Print
Expand All
Expand Minimize

WebPartManager.OnSelectedWebPartChanging Method

Raises the SelectedWebPartChanging event, which occurs during the process of changing which WebPart control is currently selected.

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

protected virtual void OnSelectedWebPartChanging(
	WebPartCancelEventArgs e
)

The OnSelectedWebPartChanging method raises the SelectedWebPartChanging event, which occurs during the process of changing which WebPart control is currently selected.

The WebPartManager control uses this method, and the associated event, to provide an opportunity to cancel a process in which the selected control is changing. For example, the method is called within the BeginWebPartEditing method, and also within the EndWebPartEditing method, to provide a way to cancel the process. If a user clicks the cancel verb on a control that is being edited, the control is no longer selected and any editing changes are not saved, because the OnSelectedWebPartChanging method makes it possible to cancel the editing changes.

NoteNote

The method is similarly called during the methods that begin and end the process of connecting a WebPart control to another control, to enable canceling that process.

Page developers can create a custom handler for the SelectedWebPartChanging event by adding the OnSelectedWebPartChanging attribute to the <asp:webpartmanager> element in declarative page markup, and assigning to the attribute the name of a custom method.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

Community Additions

ADD
Show:
© 2014 Microsoft