GridView.OnRowDataBound(GridViewRowEventArgs) 方法

定义

引发 RowDataBound 事件。

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

参数

e
GridViewRowEventArgs

包含事件数据的 GridViewRowEventArgs

注解

必须先 GridView 将控件中的每个行绑定到数据源中的记录,然后才能呈现控件。 RowDataBound当对象表示GridViewRow的数据行 () 绑定到控件中的数据时,将引发 该GridView事件。 这使你能够提供一个事件处理方法,该方法执行自定义例程,例如,每当发生此事件时,修改绑定到行的数据的值。

引发事件时,将通过委托调用事件处理程序。 有关详细信息,请参阅 处理和引发事件

OnRowDataBound 方法还允许派生类对事件进行处理而不必附加委托。 这是在派生类中处理事件的首选技术。

本主题附带了一个包含源代码的 Visual Studio 网站项目: 下载

继承者说明

在派生类中重写 OnRowDataBound(GridViewRowEventArgs) 时,一定要调用基类的 OnRowDataBound(GridViewRowEventArgs) 方法,以便已注册的委托对事件进行接收。

适用于

另请参阅