Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

WebPartManager.SelectedWebPartChanging Event

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

Occurs during the process of changing which WebPart or server control is currently selected on a Web page.

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

public event WebPartCancelEventHandler SelectedWebPartChanging
/** @event */
public void add_SelectedWebPartChanging (WebPartCancelEventHandler value)

/** @event */
public void remove_SelectedWebPartChanging (WebPartCancelEventHandler value)

JScript supports the use of events, but not the declaration of new ones.

This event can be used in conjunction with the OnSelectedWebPartChanging method. Page developers can create an event handler in their code by adding the OnSelectedWebPartChanging attribute to the <asp:webpartmanager> element in a page, and setting the value of the attribute to the name of a custom method that will handle the event.

This event is raised during the process of beginning or ending a connection between controls, and when beginning and ending an edit of a control. For details, see the OnSelectedWebPartChanging method.

Normally, when the SelectedWebPartChanging event is raised as a direct result of a user's action that changes the selected control, the event can be cancelled. However, there is a scenario in which the event cannot be cancelled. If a WebPartZone control is deleted, the WebPart controls it contains must all be closed, otherwise they would be orphaned. In this case the WebPartManager control closes the WebPart controls, not the user, and it must determine which control is currently selected and when to change the selection without any chance of interruption, so that it can complete the process of cleaning up all the controls. Therefore, by design the SelectedWebPartChanging method cannot be cancelled in this scenario. For a related event that can be cancelled, see the WebPartClosing event.

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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.