473,379 Members | 1,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Document title

How to change a document's title programmatically, from the Page_Load() for
example?
Nov 19 '05 #1
6 1471
you can either create a literal and set its text to:
<Title>Some TITLE</title>

Or, you can declare a public variable in your code like follows
public string PageTitle;

then in your Title tag do this:
<TITLE><%=PageTitle%></TITLE>

"Tumurbaatar S." <sp********@magicnet.mn> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl...
How to change a document's title programmatically, from the Page_Load()
for example?

Nov 19 '05 #2
Thank you!
There's no a special property/method to manipulate with a document title?
So, only way is to combine ASP.NET script and HTML tags.
I think that <%= PageTitle %> will assign initial value of the variable,
i.e. before
processing it within Page_Load(). May be it will work as I think:

<TITLE><%# PageTitle %></TITLE>
public string PageTitle;
Page_Load()
{
PageTitle = some_expression;
DataBind();
}

Am I right?
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:Oz*************@tk2msftngp13.phx.gbl...
you can either create a literal and set its text to:
<Title>Some TITLE</title>

Or, you can declare a public variable in your code like follows
public string PageTitle;

then in your Title tag do this:
<TITLE><%=PageTitle%></TITLE>

"Tumurbaatar S." <sp********@magicnet.mn> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl...
How to change a document's title programmatically, from the Page_Load()
for example?


Nov 19 '05 #3
Sounds fine to me, never tested i though.

if you change the # to and =, you wouldn't have to use the Page.DataBind()
method.
But it should work fine

"Tumurbaatar S." <sp********@magicnet.mn> wrote in message
news:e8**************@tk2msftngp13.phx.gbl...
Thank you!
There's no a special property/method to manipulate with a document title?
So, only way is to combine ASP.NET script and HTML tags.
I think that <%= PageTitle %> will assign initial value of the variable,
i.e. before
processing it within Page_Load(). May be it will work as I think:

<TITLE><%# PageTitle %></TITLE>
public string PageTitle;
Page_Load()
{
PageTitle = some_expression;
DataBind();
}

Am I right?
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:Oz*************@tk2msftngp13.phx.gbl...
you can either create a literal and set its text to:
<Title>Some TITLE</title>

Or, you can declare a public variable in your code like follows
public string PageTitle;

then in your Title tag do this:
<TITLE><%=PageTitle%></TITLE>

"Tumurbaatar S." <sp********@magicnet.mn> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl...
How to change a document's title programmatically, from the Page_Load()
for example?



Nov 19 '05 #4
Another option:

....
<head>
<title id="pageTitle" runat=server></title>
</head>
....

In the code-behind:

pageTitle.InnerText = "Your page title goes here...";
"Tumurbaatar S." <sp********@magicnet.mn> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl...
How to change a document's title programmatically, from the Page_Load() for
example?

Nov 19 '05 #5
i was also thinking that.

But how do you declare the title in your code behind?
Vis studio doesn't add it automatically

"Siva M" <sh******@online.excite.com> wrote in message
news:uD****************@TK2MSFTNGP09.phx.gbl...
Another option:

...
<head>
<title id="pageTitle" runat=server></title>
</head>
...

In the code-behind:

pageTitle.InnerText = "Your page title goes here...";
"Tumurbaatar S." <sp********@magicnet.mn> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl...
How to change a document's title programmatically, from the Page_Load()
for
example?

Nov 19 '05 #6
Hi,

Declare it as HtmlGenericControl.
"Grant Merwitz" <gr***@workshare.com> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
i was also thinking that.

But how do you declare the title in your code behind?
Vis studio doesn't add it automatically

"Siva M" <sh******@online.excite.com> wrote in message
news:uD****************@TK2MSFTNGP09.phx.gbl...
Another option:

...
<head>
<title id="pageTitle" runat=server></title>
</head>
...

In the code-behind:

pageTitle.InnerText = "Your page title goes here...";
"Tumurbaatar S." <sp********@magicnet.mn> wrote in message
news:e9**************@TK2MSFTNGP09.phx.gbl...
How to change a document's title programmatically, from the Page_Load()
for
example?


Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brett Baisley | last post by:
Hello I have a block of html code that I want to run by calling a javascript function to print it. Its basically a table with menu items in it that is the same for many pages, and instead of...
4
by: Richard Trahan | last post by:
(This is a repost -- the original got tucked away into an old thread because I used the same Subject name.) I'm trying to change the document title to add an asterisk when the document becomes...
9
by: Ian Renfrew | last post by:
Essentially, I want to prevent the display of the Microsoft Internet Explorer or any other branding tag in the document title. One technique that I've used is to insert multiple spaces after the...
5
by: garfy | last post by:
Hi i get this error in validation Line 22 column 6: document type does not allow element "title" here. <title>Seo Web Design Los Angeles - Web Design And Search Engine Optimization L ...
5
by: jhurrell | last post by:
I have been having some trouble getting my XSL style sheet to parse correctly. I have some XML outputted from an SQL-Server, that I then need to turn into multiple HTML files. This I have done...
3
by: Adam Lipscombe | last post by:
Folks, I want to be able to get title of a document that is presented within an Iframe with the id "popupFrame". There may be more than 1 instance of the iframe in the page. This is my...
10
by: AC | last post by:
I had a page that does some event setup on window.onload: function prepEvents() { document.getElementById("menumap_sales").onmouseover = swapMenuSales; // etc } window.onload = prepEvents;
8
by: Mateusz Viste | last post by:
Hi, I am trying make some multimedia files playable from my website. So far, I am able to generate dynamically a new page containing the right <embed> section. However, when I load my script, it...
11
Dormilich
by: Dormilich | last post by:
Lately I have seen so much awful HTML, that I like to show what a HTML document should look like, regarding the requirements from the W3C. the absolute minimum is defined as: or expressed in...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.