HtmlAnchor.OnPreRender Method

Raises the PreRender event and registers client script for generating a postback.

Namespace: System.Web.UI.HtmlControls
Assembly: System.Web (in system.web.dll)

protected public:
virtual void OnPreRender (
	EventArgs^ e
) override
protected void OnPreRender (
	EventArgs e
)
protected internal override function OnPreRender (
	e : EventArgs
)

Parameters

e

An EventArgs that contains the event data.

The following code example demonstrates how to override the OnPreRender method so that it always displays a Title tag in a custom HtmlAnchor server control.

No code example is currently available or this language may not be supported.
<%@ Register TagPrefix="aspSample" Namespace="Samples.AspNet.JSL.Controls" Assembly="Samples.AspNet.JSL" %>
<%@ Page Language="VJ#" AutoEventWireup="True" %>
<HTML>
  <HEAD>
    <title>Custom HtmlAnchor - OnPreRender - VJ# Example</title>
  </HEAD>
  <body>
    <form id="Form1" method="post" runat="server">
      Top of Page
      &lt;<aspSample:CustomHtmlAnchorOnPreRender
           id="HtmlAnchor1"
           runat="server"
           name="HtmlAnchor1">HtmlAnchor1</aspSample:CustomHtmlAnchorOnPreRender>&gt;

      <h3>Custom HtmlAnchor - OnPreRender - VJ# Example</h3>
      <P>&nbsp;</P>
      <P>Jump to <A href="#HtmlAnchor2">HtmlAnchor2</A> below.</P>

      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>
      <P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>

      <P>Jump to <A href="#HtmlAnchor1">HtmlAnchor1</A> above.</P>
      <P>&nbsp;</P>Bottom of Page
      &lt;<aspSample:CustomHtmlAnchorOnPreRender
           id="HtmlAnchor2"
           runat="server"
           name="HtmlAnchor2">HtmlAnchor2</aspSample:CustomHtmlAnchorOnPreRender>&gt;
    </form>
  </body>
</HTML>

No code example is currently available or this language may not be supported.
package Samples.AspNet.JSL.Controls;

public class CustomHtmlAnchorOnPreRender
    extends System.Web.UI.HtmlControls.HtmlAnchor
{
    protected void OnPreRender(System.EventArgs e)
    {
        // Call the base OnPreRender method.
        super.OnPreRender(e);
        // Write out the HtmlAnchor's Title tag
        this.set_Title("Text from OnPreRender.");
    } //OnPreRender
} //CustomHtmlAnchorOnPreRender

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show: