BaseValidator.OnInit(EventArgs) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
引發 Init 事件。
protected:
override void OnInit(EventArgs ^ e);
protected public:
override void OnInit(EventArgs ^ e);
protected override void OnInit(EventArgs e);
protected internal override void OnInit(EventArgs e);
override this.OnInit : EventArgs -> unit
Protected Overrides Sub OnInit (e As EventArgs)
Protected Friend Overrides Sub OnInit (e As EventArgs)
參數
備註
此方法呼叫基礎控制OnInit項的方法後,若以下條件成立,則會將屬性ForeColor設定為:Red
屬性 ForeColor 尚未設定。
該 RenderingCompatibility 性質表示在
4.0之前的 ASP.NET 版本。 預設情況下,ASP.NET 4 及以後版本的驗證器控制項不會以紅色顯示錯誤。 關於如何控制驗證者控制項的視覺外觀,請參閱「 ASP.NET 網頁中的使用者輸入驗證」。
此方法同時在頁面上註冊驗證控制。
給繼承者的注意事項
在導出類別中覆寫 OnInit(EventArgs) 時,務必呼叫基底類別的方法 OnInit(EventArgs) ,讓註冊代理接收事件。