BaseValidator.OnInit(EventArgs) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Raises the Init event.
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)
Parameters
Remarks
After this method calls the base control's OnInit method, it sets the ForeColor property to Red if the following conditions are true:
The ForeColor property is not already set.
The RenderingCompatibility property indicates an ASP.NET version earlier than
4.0
. By default, validator controls in ASP.NET 4 and later versions do not display errors in red. For information about how to control the visual appearance of validator controls, see Validating User Input in ASP.NET Web Pages.
This method also registers the validation control on the page.
Notes to Inheritors
When overriding OnInit(EventArgs) in a derived class, be sure to call the base class's OnInit(EventArgs) method so that registered delegates receive the event.