ASP.NET Tutorial/HTML Controls/Header — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 15:00, 26 мая 2010
Содержание
Use HtmlHead control to set the add page transition effects when viewed through Internet Explorer.
<source lang="csharp">
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<meta http-equiv="Page-Enter" content="progid:DXImageTransform.Microsoft.Fade(duration=.5)" /> <meta http-equiv="Page-Exit" content="progid:DXImageTransform.Microsoft.Fade(duration=.5)" /> <title>Transition Effects</title>
</head> <body>
<form id="form1" runat="server">
This is sample page with special transition effects
<a href="head.aspx">Visit another page and then come back here</a>
</form>
</body> </html></source>
Use HtmlHead control to set the page title and meta tags.
<source lang="csharp">
<%@ Page Language="C#" AutoEventWireup="true"%> <script runat="server">
void buttonSet_Click(object sender, EventArgs e) { Header.Title = Msg.Text; } void buttonMetaSet_Click(object sender, EventArgs e) { string format = "<meta http-equiv="refresh" content="{0}" />"; LiteralControl equiv; equiv = new LiteralControl(String.Format(format, Content.Text)); ((Control)Header).Controls.Add(equiv); Response.Write("This text will disappear in 3 seconds..."); }
</script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">
<title>Testing HtmlHead</title>
</head> <body>
<form runat="server" id="MainForm">
Set the title
<asp:textbox runat="server" id="Msg" text="This is the title" /> <asp:button runat="server" id="buttonSet" text="Set" onclick="buttonSet_Click" />
Set HTTP-EQUIV tag
<asp:textbox runat="server" id="Content" text="3" /> <asp:button runat="server" id="buttonMetaSet" text="Set" onclick="buttonMetaSet_Click" />
</form>
</body> </html></source>