GridView.OnDataSourceViewChanged(Object, EventArgs) 方法

定义

引发 DataSourceViewChanged 事件。Raises the DataSourceViewChanged event.

protected:
 override void OnDataSourceViewChanged(System::Object ^ sender, EventArgs ^ e);
protected override void OnDataSourceViewChanged (object sender, EventArgs e);
override this.OnDataSourceViewChanged : obj * EventArgs -> unit
Protected Overrides Sub OnDataSourceViewChanged (sender As Object, e As EventArgs)

参数

sender
Object

事件源。The source of the event.

e
EventArgs

包含事件数据的 EventArgsAn EventArgs that contains the event data.

注解

OnDataSourceViewChanged方法通知 GridView 控件,基础数据源已更改,且控件应重新绑定。The OnDataSourceViewChanged method notifies a GridView control that the underlying data source has changed and that the control should rebind. 通常, OnDataSourceViewChanged 当数据源视图的属性发生更改时,将调用方法。Typically, the OnDataSourceViewChanged method is called when a property of the data source view has changed.

引发事件时,将通过委托调用事件处理程序。Raising an event invokes the event handler through a delegate. 有关详细信息,请参阅 处理和引发事件For more information, see Handling and Raising Events.

OnDataSourceViewChanged 方法还允许派生类对事件进行处理而不必附加委托。The OnDataSourceViewChanged method also allows derived classes to handle the event without attaching a delegate. 这是在派生类中处理事件的首选技术。This is the preferred technique for handling the event in a derived class.

继承者说明

在派生类中重写 OnDataSourceViewChanged(Object, EventArgs) 时,一定要调用基类的 OnDataSourceViewChanged(Object, EventArgs) 方法,以便已注册的委托对事件进行接收。When overriding OnDataSourceViewChanged(Object, EventArgs) in a derived class, be sure to call the base class's OnDataSourceViewChanged(Object, EventArgs) method so that registered delegates receive the event.

适用于

另请参阅