HtmlTitle Class

HtmlTitle Class

Note: This class is new in the .NET Framework version 2.0.

Allows programmatic access to the HTML <title> element on the server.

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

public class HtmlTitle : HtmlControl
public class HtmlTitle extends HtmlControl
public class HtmlTitle extends HtmlControl

Use the HtmlTitle class to programmatically specify the HTML <title> element of a Web Forms page.


You can also set the page title by using the title attribute of the @ Page directive, or by setting the Title property of the Page class.

The following code example demonstrates how to display the current date and time in the title bar of the Web page.

<%@ Page Language="C#" %>

<script runat="server">
  void Page_Load(object sender, EventArgs e)

    if (Page.Header != null)
      Page.Header.Title = "Welcome!  The time is: " + System.DateTime.Now;


  <head id="Head1" runat="server">



    <form id="form1" runat="server">

      <h3>HtmlTitle Example</h3>





Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

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

Community Additions

© 2015 Microsoft