Επεξεργασία

Κοινή χρήση μέσω


WebPartManager.OnSelectedWebPartChanging(WebPartCancelEventArgs) Method

Definition

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

protected:
 virtual void OnSelectedWebPartChanging(System::Web::UI::WebControls::WebParts::WebPartCancelEventArgs ^ e);
protected virtual void OnSelectedWebPartChanging (System.Web.UI.WebControls.WebParts.WebPartCancelEventArgs e);
abstract member OnSelectedWebPartChanging : System.Web.UI.WebControls.WebParts.WebPartCancelEventArgs -> unit
override this.OnSelectedWebPartChanging : System.Web.UI.WebControls.WebParts.WebPartCancelEventArgs -> unit
Protected Overridable Sub OnSelectedWebPartChanging (e As WebPartCancelEventArgs)

Parameters

e
WebPartCancelEventArgs

A WebPartCancelEventArgs that contains the event data.

Remarks

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.

Note

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.

Applies to

See also