Control.OnPreRender(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 PreRender event.
protected:
virtual void OnPreRender(EventArgs ^ e);
protected public:
virtual void OnPreRender(EventArgs ^ e);
protected virtual void OnPreRender (EventArgs e);
protected internal virtual void OnPreRender (EventArgs e);
abstract member OnPreRender : EventArgs -> unit
override this.OnPreRender : EventArgs -> unit
Protected Overridable Sub OnPreRender (e As EventArgs)
Protected Friend Overridable Sub OnPreRender (e As EventArgs)
Parameters
Examples
// Override the OnPreRender method to set _message to
// a default value if it is null.
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (_message == null)
_message = "Here is some default text.";
}
' Override the OnPreRender method to set _message to
' a default value if it is null.
Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
MyBase.OnPreRender(e)
If _message Is Nothing Then
_message = "Here is some default text."
End If
End Sub
Remarks
ASP.NET calls this method to raise the PreRender event. If you are developing a custom control, you can override this method in order to provide additional processing. If you override this method, call the base control's OnPreRender method to notify subscribers to the event.
Applies to
See also
Collaborate with us on GitHub
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.