programatically change title of page

M

Mark

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
 
K

Karl

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
 
M

Mark

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>
 
K

Karl

<%=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
 
M

Mark

Different Mark answwering the question.
Karl said:
<%=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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top