获取或设置 HTML
元素的文本。Gets or sets the text of the HTML element.public:
virtual property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerDefaultProperty)]
public virtual string Text { get; set; }
[]
member this.Text : string with get, set
Public Overridable Property Text As String
属性值
HTML
元素的文本。The text of the HTML element. 默认值为空字符串 ("")。The default value is an empty string ("").示例
下面的代码示例演示如何使用 Text 控件的属性 HtmlTitle 来动态更改网页的标题。The following code example demonstrates using the Text property of an HtmlTitle control to dynamically change the title of a Web page.
/p>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
void Page_Load(object sender, EventArgs e)
{
if (Page.Header != null)
{
Page.Header.Title = "Welcome! The time is: " + System.DateTime.Now;
}
}
HtmlTitle ExampleHtmlTitle Example
/p>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
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
HtmlTitle ExampleHtmlTitle Example
注解
使用 Text 属性指定或确定网页的标题。Use the Text property to specify or determine the title of the Web page.
适用于