HtmlTitle Construtor
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Inicializa uma nova instância da HtmlTitle classe.
public:
HtmlTitle();
public HtmlTitle();
Public Sub New ()
Exemplos
O exemplo de código seguinte demonstra como mostrar a data e hora atuais na barra de título da página Web.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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 xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>HtmlTitle Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>HtmlTitle Example</h3>
</form>
</body>
</html>
<%@ Page Language="VB" AutoEventWireup="true"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If (Page.Header IsNot Nothing) Then
Page.Header.Title = "Welcome! The time is: " & System.DateTime.Now
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>HtmlTitle Example</title>
</head>
<body>
<form id="form1" runat="server">
<h3>HtmlTitle Example</h3>
</form>
</body>
</html>
Observações
Use este construtor para criar e inicializar uma nova instância do HtmlTitle controlo usando valores por defeito. Cria um elemento HTML <title> na página Web. A tabela seguinte mostra o valor inicial da propriedade para uma instância da HtmlTitle classe.
| Property | Valor Inicial |
|---|---|
| TagName | A corda literal "title". |