This documentation is archived and is not being maintained.

WebPartManager.OnSelectedWebPartChanging Method

Note: This method is new in the .NET Framework version 2.0.

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
)
protected void OnSelectedWebPartChanging (
	WebPartCancelEventArgs e
)
protected function OnSelectedWebPartChanging (
	e : WebPartCancelEventArgs
)

Parameters

e

A WebPartCancelEventArgs that contains the event data.

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.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0
Show: