Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

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.

NoteNote

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;
      
    }
    
  }
    
</script>

<html>

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

  </head>

  <body>

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

      <h3>HtmlTitle Example</h3>

    </form>

  </body>

</html>

System.Object
   System.Web.UI.Control
     System.Web.UI.HtmlControls.HtmlControl
      System.Web.UI.HtmlControls.HtmlTitle
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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.