WebPartManager.OnSelectedWebPartChanging(WebPartCancelEventArgs) 方法
定义
引发 SelectedWebPartChanging 事件,该事件在更改当前选择的 WebPart 控件的过程中发生。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)
参数
包含事件数据的 WebPartCancelEventArgs。A WebPartCancelEventArgs that contains the event data.
注解
OnSelectedWebPartChanging方法引发 SelectedWebPartChanging 事件,该事件在更改当前选定的控件的过程中发生 WebPart 。The OnSelectedWebPartChanging method raises the SelectedWebPartChanging event, which occurs during the process of changing which WebPart control is currently selected.
WebPartManager控件使用此方法和关联的事件,以提供取消所选控件更改的进程的机会。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. 例如,方法在方法中调用,也在方法中调用 BeginWebPartEditing EndWebPartEditing ,以便提供取消进程的方法。For example, the method is called within the BeginWebPartEditing method, and also within the EndWebPartEditing method, to provide a way to cancel the process. 如果用户单击正在编辑的控件上的 cancel 谓词,则不再选择该控件并且不会保存任何编辑更改,因为 OnSelectedWebPartChanging 方法可以取消编辑更改。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.
备注
在开始和结束将控件连接到另一控件的过程的方法中,可通过类似方式调用方法 WebPart ,以启用取消该进程。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.
页面开发人员可以 SelectedWebPartChanging 通过 OnSelectedWebPartChanging <asp:webpartmanager> 在声明性页标记中将特性添加到元素,并为属性分配自定义方法的名称,来为事件创建自定义处理程序。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.