語言

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 A 包含事件資料。

備註

在控制項渲染之前 GridView ,控制項中的每一列必須綁定到資料來源中的記錄。 RowDataBound當資料列(由物件GridViewRow表示)綁定到控制項中的GridView資料時,該事件就會被觸發。 這讓你能提供一種事件處理方法,執行自訂例程,例如在事件發生時修改綁定到該列的資料值。

發起事件會透過代理呼叫事件處理者。 欲了解更多資訊,請參閱 處理與提升事件。

此 OnRowDataBound 方法也允許衍生類別在不附加代理的情況下處理事件。 這是在衍生類別中處理事件的首選技術。

有一個包含原始碼的 Visual Studio 網站專案可供此主題提供: 下載。

給繼承者的注意事項

在導出類別中覆寫 OnRowDataBound(GridViewRowEventArgs) 時,務必呼叫基底類別的方法 OnRowDataBound(GridViewRowEventArgs) ,讓註冊代理接收事件。

適用於

另請參閱