Method 1.
First: On the. aspx page:
<HEAD>
<title>
<%=pagetitle%>
</title>
。。。。。。。
</HEAD>
Second: on the. Aspx.cs page:
public class News_view:System.Web.UI.Page
{
。。。。。。。。。。。。
Use to dynamically set page titles
protected string PageTitle;
。。。。
private void Page_Load (object sender, System.EventArgs e)
{
。。。。。。。
Dynamically set the title of a Web page title to display the page content "caption"
Pagetitle=lblbiaoti.text;
。。。
Note: The Lblbiaoti here is a label control, or it can be a TextBox control or another server control.
Pagetitle=lblbiaoti.text the Text property of the Lblbiaoti must be assigned a value before the sentence.
Method 2: Use the literal control
First: Drag a literal control into the. aspx page. The ID is set to PageTitle.
Second: Enter the HTML page of the. aspx, and completely cut and paste the code of the newly added literal control between <title> and </title>.
Finally: in the appropriate position of the. Aspx.cs page, set the value of PageTitle in the Pageload function.
Example:
In. aspx:
<Head>
<title>
<asp:literal id= "pagetitle" runat= "Server" > </asp:Literal>
</title>
In the. Aspx.cs:
public class News_view:System.Web.UI.Page
{
。。。。。。。。。。。。
Use to dynamically set page titles
protected string PageTitle;
。。。。
private void Page_Load (object sender, System.EventArgs e)
{
。。。。。。。
Dynamically set the title of a Web page title to display the page content "caption"
Pagetitle=lblbiaoti.text;
。。。
Note: The Lblbiaoti here is a label control, or it can be a TextBox control or another server control.
Pagetitle=lblbiaoti.text the Text property of the Lblbiaoti must be assigned a value before the sentence.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.