473,406 Members | 2,713 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,406 software developers and data experts.

programatically change title of page

I'd like to be able programmatically modify the title of a web page. For
example, change:

<head><title>something</title></head>

to

<head><title>something else</title></head>

Is there a property of the Page or similar that I could do this with in a
codebehind?

Thanks in advance.
mark
Nov 18 '05 #1
5 1693
The only way I know of is to do something like this
<head>
<title id="title" runat="server" />
</head>
and in your code you can declare the title as an
HtmlControls.HtmlGenericControl and set the innerText property to whatever
you want.

Karl

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
I'd like to be able programmatically modify the title of a web page. For
example, change:

<head><title>something</title></head>

to

<head><title>something else</title></head>

Is there a property of the Page or similar that I could do this with in a
codebehind?

Thanks in advance.
mark

Nov 18 '05 #2
Wouldn't this work?
Sub Page_Load
Dim strTitle AS String

If something is true then
strTitle ="sometitle"
Else
strTitle = "someothertitle"
End If
End Sub

<head>
<title><%strTitle%></title>
</head>


"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
The only way I know of is to do something like this
<head>
<title id="title" runat="server" />
</head>
and in your code you can declare the title as an
HtmlControls.HtmlGenericControl and set the innerText property to whatever you want.

Karl

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
I'd like to be able programmatically modify the title of a web page. For example, change:

<head><title>something</title></head>

to

<head><title>something else</title></head>

Is there a property of the Page or similar that I could do this with in a codebehind?

Thanks in advance.
mark


Nov 18 '05 #3
<%=strTitle%> would yes...
But if you knew the answer to your question, why did you ask? ..you could
have just tried it out :P

I just gave you a more .net way of doing it..because now you have a nice
object of type htlmgenericControl you can do things with...

Karl
"Mark" <py*******@hotmail.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Wouldn't this work?
Sub Page_Load
Dim strTitle AS String

If something is true then
strTitle ="sometitle"
Else
strTitle = "someothertitle"
End If
End Sub

<head>
<title><%strTitle%></title>
</head>


"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
The only way I know of is to do something like this
<head>
<title id="title" runat="server" />
</head>
and in your code you can declare the title as an
HtmlControls.HtmlGenericControl and set the innerText property to whatever
you want.

Karl

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
I'd like to be able programmatically modify the title of a web page. For example, change:

<head><title>something</title></head>

to

<head><title>something else</title></head>

Is there a property of the Page or similar that I could do this with
in a codebehind?

Thanks in advance.
mark



Nov 18 '05 #4
Different Mark answwering the question.
"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:OX*************@TK2MSFTNGP12.phx.gbl...
<%=strTitle%> would yes...
But if you knew the answer to your question, why did you ask? ..you could
have just tried it out :P

I just gave you a more .net way of doing it..because now you have a nice
object of type htlmgenericControl you can do things with...

Karl
"Mark" <py*******@hotmail.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Wouldn't this work?
Sub Page_Load
Dim strTitle AS String

If something is true then
strTitle ="sometitle"
Else
strTitle = "someothertitle"
End If
End Sub

<head>
<title><%strTitle%></title>
</head>


"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
The only way I know of is to do something like this
<head>
<title id="title" runat="server" />
</head>
and in your code you can declare the title as an
HtmlControls.HtmlGenericControl and set the innerText property to

whatever
you want.

Karl

"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
> I'd like to be able programmatically modify the title of a web page.

For
> example, change:
>
> <head><title>something</title></head>
>
> to
>
> <head><title>something else</title></head>
>
> Is there a property of the Page or similar that I could do this with

in
a
> codebehind?
>
> Thanks in advance.
> mark
>
>



Nov 18 '05 #5
teehee :)

Karl

"Mark" <py*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Different Mark answwering the question.
"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:OX*************@TK2MSFTNGP12.phx.gbl...
<%=strTitle%> would yes...
But if you knew the answer to your question, why did you ask? ..you could
have just tried it out :P

I just gave you a more .net way of doing it..because now you have a nice
object of type htlmgenericControl you can do things with...

Karl
"Mark" <py*******@hotmail.com> wrote in message
news:%2******************@tk2msftngp13.phx.gbl...
Wouldn't this work?
Sub Page_Load
Dim strTitle AS String

If something is true then
strTitle ="sometitle"
Else
strTitle = "someothertitle"
End If
End Sub

<head>
<title><%strTitle%></title>
</head>


"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in message news:%2****************@TK2MSFTNGP10.phx.gbl...
> The only way I know of is to do something like this
> <head>
> <title id="title" runat="server" />
> </head>
>
>
> and in your code you can declare the title as an
> HtmlControls.HtmlGenericControl and set the innerText property to
whatever
> you want.
>
> Karl
>
> "Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
> news:OA**************@tk2msftngp13.phx.gbl...
> > I'd like to be able programmatically modify the title of a web page. For
> > example, change:
> >
> > <head><title>something</title></head>
> >
> > to
> >
> > <head><title>something else</title></head>
> >
> > Is there a property of the Page or similar that I could do this

with in
a
> > codebehind?
> >
> > Thanks in advance.
> > mark
> >
> >
>
>



Nov 18 '05 #6

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

Similar topics

6
by: the wonderer | last post by:
This is an elementary question, but I've not been able to find the answer, so here goes: I am developing a site using php. I have the html header information in a file that I include in all the...
4
by: Csaba2000 | last post by:
I want to be able to programatically click on the center of an <INPUT type=image ...> element (I only care about IE 5.5+). This should work regardless of whether IE has focus. Normally you would...
0
by: Rainer Halanek | last post by:
Hi, I want to write an asp.net application, that fills out automatically some fields on a webpage (public one, not asp.net), press there a submit button and do some more stuff (like filling out...
3
by: Craig Wilson | last post by:
How do I programmatically change the page title in ASP.Net In general, I need to get at the object model that gets access to the title property. best wishes,
14
by: Paul | last post by:
I want to set the page title and/or a form hidden field programatically through ASP.Net. I do not want to use something like... <% sTitle ="My Title" %> <html><title><%=sTitle%></title>..... ...
9
by: Neo Geshel | last post by:
I have strip-mined, strip-searched, and completely exhausted the Internet (up to the 30th page on Google, with 100 results per page!!), all without finding an answer to my question AS TO WHY IT...
8
by: Rak | last post by:
I am looking for a way to programatically change the .net version of the virtual directory that I am creating within a aspx page. As part of creating a new customer in my asp.net 2 application, it...
5
by: Tim Mackey | last post by:
hi, i have put my web.sitemap in /App_Data so i can edit it programatically via a web admin page, inheriting the modify permissions from the App_Data folder etc. i was hoping the provider would...
0
by: hikmaverick | last post by:
Hi all, the title of my topic is a copy from an old message posted by Grey Allen, about twenty days ago. As Grey, I am trying to programatically POST an ASP form, to allow me to log on to a site...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.