Can I dynamically set the TITLE tag of a page?
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngclient' list.


Damian Barrow
-- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot <Click here to reveal e-mail address> --

Based on a database entry..

Ie <asp:title id="title" text="database_field..." />

Reply to this message...
 
    
James Avery
The easiest way would be to throw a literal control into the title and
just set the text of that. It looks like you can set the title to
runat=server, but VS.net deletes it.

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 8:10 AM
To: aspngclient
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

-- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --

Based on a database entry..

Ie <asp:title id="title" text="database_field..." />
| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

Reply to this message...
 
    
Ollie Cornes

Add an id attribute to the Title tag. Also add the runat="server" attribute.

<title runat="server" id="myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle = "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat="server" in your title tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

Reply to this message...
 
    
Damian Barrow
Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried=20

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs)
Line 14:=20
Line 15:     protected HtmlGenericControl myTitle
Line 16:     titleTag =3D "Sir Barrow of Chorley"
Line 17:     end protected=20

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat=3D"server"
attribute.

<title runat=3D"server" id=3D"myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle =3D "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat=3D"server" in your title =
tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

Reply to this message...
 
    
Damian Barrow
Sorry guys - still not getting this
Test page is:

<%@ Page Language=3D"VB" ContentType=3D"text/html"
ResponseEncoding=3D"iso-8859-1" %>
<script language=3D"VB" runat=3D"server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

    Dim myTitle As HtmlGenericControl
     myTitle =3D "Sir Barrow of Chorley"
=09
End Sub
</script>
<html xmlns=3D"http://www.w3.org/1999/xhtml";>
<head>
<title id=3D"myTitle" runat=3D"server">notChanged</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"
/>
</head>
<body>
</body>
</html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway.
It must be doable as I've found some pages in german and Thai that show
how you can with codebehind, but not any with inline code.
It'd be awesome for search engine positiioning if I could suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow=20
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried=20

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15:     protected HtmlGenericControl myTitle
Line 16:     titleTag =3D "Sir Barrow of Chorley"
Line 17:     end protected=20

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat=3D"server"
attribute.

<title runat=3D"server" id=3D"myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle =3D "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat=3D"server" in your title =
tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

Reply to this message...
 
    
James Avery
Try .Text

myTitle.Text = ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %> <script language="VB" runat="server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

    Dim myTitle As HtmlGenericControl
     myTitle = "Sir Barrow of Chorley"
    
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title id="myTitle" runat="server">notChanged</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15:     protected HtmlGenericControl myTitle
Line 16:     titleTag = "Sir Barrow of Chorley"
Line 17:     end protected

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat="server"
attribute.

<title runat="server" id="myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle = "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat="server" in your title tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

Reply to this message...
 
    
Damian Barrow
I tried that
Compiler Error Message: BC30456: 'Text' is not a member of
'System.Web.UI.HtmlControls.HtmlGenericControl'.

Hence the innerHTML bit but no banana on that one either.

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 16:08
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Try .Text=20

myTitle.Text =3D ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language=3D"VB" ContentType=3D"text/html"
ResponseEncoding=3D"iso-8859-1" %> <script language=3D"VB" =
runat=3D"server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

    Dim myTitle As HtmlGenericControl
     myTitle =3D "Sir Barrow of Chorley"
=09
End Sub
</script>
<html xmlns=3D"http://www.w3.org/1999/xhtml";>
<head>
<title id=3D"myTitle" runat=3D"server">notChanged</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow=20
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried=20

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15:     protected HtmlGenericControl myTitle
Line 16:     titleTag =3D "Sir Barrow of Chorley"
Line 17:     end protected=20

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat=3D"server"
attribute.

<title runat=3D"server" id=3D"myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle =3D "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat=3D"server" in your title =
tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

Reply to this message...
 
    
James Avery
Also try .InnerText, what error did you get on .InnerHTML?

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 11:24 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

I tried that
Compiler Error Message: BC30456: 'Text' is not a member of
'System.Web.UI.HtmlControls.HtmlGenericControl'.

Hence the innerHTML bit but no banana on that one either.

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 16:08
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Try .Text

myTitle.Text = ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %> <script language="VB" runat="server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

    Dim myTitle As HtmlGenericControl
     myTitle = "Sir Barrow of Chorley"
    
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title id="myTitle" runat="server">notChanged</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15:     protected HtmlGenericControl myTitle
Line 16:     titleTag = "Sir Barrow of Chorley"
Line 17:     end protected

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat="server"
attribute.

<title runat="server" id="myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle = "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat="server" in your title tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

Reply to this message...
 
    
Damian Barrow
http://www.travelcounsellors.com/title.aspx

Is the page.
Its doing my head in as otherwise I'd have to manually manipulate 400+
pages just for the sake of changing a couple of bits.

The code is:

<%@ Page Language=3D"VB" ContentType=3D"text/html"
ResponseEncoding=3D"iso-8859-1" %>
<script language=3D"VB" runat=3D"server">
=09
Public Sub Page_Load(Sender as Object, E as EventArgs)

    Dim myTitle As HtmlGenericControl
     myTitle.InnerText =3D "Sir Barrow of Chorley"
=09
End Sub
</script>

<html xmlns=3D"http://www.w3.org/1999/xhtml";>
<head>
<title id=3D"myTitle" runat=3D"server">notChanged</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"
/>
</head>
<body>
</body>
</html>

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 16:26
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Also try .InnerText, what error did you get on .InnerHTML?

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, August 01, 2002 11:24 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

I tried that
Compiler Error Message: BC30456: 'Text' is not a member of
'System.Web.UI.HtmlControls.HtmlGenericControl'.

Hence the innerHTML bit but no banana on that one either.

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 16:08
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Try .Text=20

myTitle.Text =3D ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language=3D"VB" ContentType=3D"text/html"
ResponseEncoding=3D"iso-8859-1" %> <script language=3D"VB" =
runat=3D"server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

    Dim myTitle As HtmlGenericControl
     myTitle =3D "Sir Barrow of Chorley"
=09
End Sub
</script>
<html xmlns=3D"http://www.w3.org/1999/xhtml";>
<head>
<title id=3D"myTitle" runat=3D"server">notChanged</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow=20
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried=20

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15:     protected HtmlGenericControl myTitle
Line 16:     titleTag =3D "Sir Barrow of Chorley"
Line 17:     end protected=20

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat=3D"server"
attribute.

<title runat=3D"server" id=3D"myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle =3D "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat=3D"server" in your title =
tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

Reply to this message...
 
    
James Avery
What if you do it like this:

protected myTitle as HtmlGenericControl

Public Sub Page_Load(Sender as Object, E as EventArgs)

myTitle.InnerText = "Sir Barrow of Chorley"
    
End Sub

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 11:32 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

http://www.travelcounsellors.com/title.aspx

Is the page.
Its doing my head in as otherwise I'd have to manually manipulate 400+
pages just for the sake of changing a couple of bits.

The code is:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %> <script language="VB" runat="server">
    
Public Sub Page_Load(Sender as Object, E as EventArgs)

    Dim myTitle As HtmlGenericControl
     myTitle.InnerText = "Sir Barrow of Chorley"
    
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title id="myTitle" runat="server">notChanged</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/> </head> <body> </body> </html>

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 16:26
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Also try .InnerText, what error did you get on .InnerHTML?

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 11:24 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

I tried that
Compiler Error Message: BC30456: 'Text' is not a member of
'System.Web.UI.HtmlControls.HtmlGenericControl'.

Hence the innerHTML bit but no banana on that one either.

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 16:08
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Try .Text

myTitle.Text = ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %> <script language="VB" runat="server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

    Dim myTitle As HtmlGenericControl
     myTitle = "Sir Barrow of Chorley"
    
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title id="myTitle" runat="server">notChanged</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15:     protected HtmlGenericControl myTitle
Line 16:     titleTag = "Sir Barrow of Chorley"
Line 17:     end protected

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat="server"
attribute.

<title runat="server" id="myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle = "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat="server" in your title tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

Reply to this message...
 
    
Matthew Tamm
try this..

<html>
<head>
<asp:literal runat=server id=litTitle />
</head>
</html>

( excuse my VB - I am a C# person )

Public Class WebForm1...

Protected litTitle AS System.Web.UI.WebControls.Literal

Private Sub Page_Load()...
litTitle.Text = "myNewPageTitle"
End Sub

End Class

I would even suggest moving the whole idea into a user control, title could
be a property, the control could be cached, you could also include other
code global to your pages...CSS, script, META etc. ( 'tis what I do )

hth

Matthew

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 10:23 AM
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a page?

I tried that
Compiler Error Message: BC30456: 'Text' is not a member of
'System.Web.UI.HtmlControls.HtmlGenericControl'.

Hence the innerHTML bit but no banana on that one either.

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 16:08
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Try .Text

myTitle.Text = ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %> <script language="VB" runat="server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

Dim myTitle As HtmlGenericControl
myTitle = "Sir Barrow of Chorley"

End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title id="myTitle" runat="server">notChanged</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15: protected HtmlGenericControl myTitle
Line 16: titleTag = "Sir Barrow of Chorley"
Line 17: end protected

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat="server"
attribute.

<title runat="server" id="myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle = "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat="server" in your title tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

Reply to this message...
 
    
Matthew Tamm
of I forgot to add either...

<title><asp:literal runat=server id=litTitle /></title>

or

litTitle.Text = "<title>myNewPageTitle</title>"

Matt.

----- Original Message -----
From: "Matthew Tamm" <Click here to reveal e-mail address>

try this..

<html>
<head>
<asp:literal runat=server id=litTitle />
</head>
</html>

( excuse my VB - I am a C# person )

Public Class WebForm1...

Protected litTitle AS System.Web.UI.WebControls.Literal

Private Sub Page_Load()...
litTitle.Text = "myNewPageTitle"
End Sub

End Class

I would even suggest moving the whole idea into a user control, title could
be a property, the control could be cached, you could also include other
code global to your pages...CSS, script, META etc. ( 'tis what I do )

hth

Matthew

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 10:23 AM
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a page?

I tried that
Compiler Error Message: BC30456: 'Text' is not a member of
'System.Web.UI.HtmlControls.HtmlGenericControl'.

Hence the innerHTML bit but no banana on that one either.

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 16:08
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Try .Text

myTitle.Text = ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language="VB" ContentType="text/html"
ResponseEncoding="iso-8859-1" %> <script language="VB" runat="server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

Dim myTitle As HtmlGenericControl
myTitle = "Sir Barrow of Chorley"

End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title id="myTitle" runat="server">notChanged</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15: protected HtmlGenericControl myTitle
Line 16: titleTag = "Sir Barrow of Chorley"
Line 17: end protected

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat="server"
attribute.

<title runat="server" id="myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle = "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat="server" in your title tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp = JOIN/QUIT

Reply to this message...
 
    
Damian Barrow
Have you got any examples of this?=20
If you don't mind, a copy of a page and the ascx would be nice.

James' solution doesn't work.

I'm going to look into the controls thing a bit but I think I need to do
some digging first as I have *no idea* what you're talking about.

Cheers
Damian

-----Original Message-----
From: Matthew Tamm [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 16:34
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

try this..

<html>
<head>
<asp:literal runat=3Dserver id=3DlitTitle />
</head>
</html>

( excuse my VB - I am a C# person )

Public Class WebForm1...

Protected litTitle AS System.Web.UI.WebControls.Literal

Private Sub Page_Load()...
litTitle.Text =3D "myNewPageTitle"
End Sub

End Class

I would even suggest moving the whole idea into a user control, title
could be a property, the control could be cached, you could also include
other code global to your pages...CSS, script, META etc. ( 'tis what I
do )

hth

Matthew

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 10:23 AM
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

I tried that
Compiler Error Message: BC30456: 'Text' is not a member of
'System.Web.UI.HtmlControls.HtmlGenericControl'.

Hence the innerHTML bit but no banana on that one either.

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 16:08
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Try .Text

myTitle.Text =3D ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language=3D"VB" ContentType=3D"text/html"
ResponseEncoding=3D"iso-8859-1" %> <script language=3D"VB" =
runat=3D"server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

Dim myTitle As HtmlGenericControl
myTitle =3D "Sir Barrow of Chorley"

End Sub
</script>
<html xmlns=3D"http://www.w3.org/1999/xhtml";>
<head>
<title id=3D"myTitle" runat=3D"server">notChanged</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15: protected HtmlGenericControl myTitle
Line 16: titleTag =3D "Sir Barrow of Chorley"
Line 17: end protected

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat=3D"server"
attribute.

<title runat=3D"server" id=3D"myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle =3D "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat=3D"server" in your title =
tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

Reply to this message...
 
    
Damian Barrow
Sok. I got it.

<%@ Page Language=3D"VB" ContentType=3D"text/html"
ResponseEncoding=3D"iso-8859-1" %>
<script language=3D"VB" runat=3D"server">

Public Sub Page_Load(Sender as Object, E as EventArgs)

     myTitle.text =3D "Sir Barrow of Chorley"
=09
End Sub
</script>

<html xmlns=3D"http://www.w3.org/1999/xhtml";>
<head>
<title><asp:literal id=3D"myTitle" =
runat=3D"server"></asp:literal></title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"
/>
</head>
<body>
</body>
</html>

Cheers all
Damian

-----Original Message-----
From: Matthew Tamm [mailto:Click here to reveal e-mail address]=20
Sent: 01 August 2002 16:34
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

try this..

<html>
<head>
<asp:literal runat=3Dserver id=3DlitTitle />
</head>
</html>

( excuse my VB - I am a C# person )

Public Class WebForm1...

Protected litTitle AS System.Web.UI.WebControls.Literal

Private Sub Page_Load()...
litTitle.Text =3D "myNewPageTitle"
End Sub

End Class

I would even suggest moving the whole idea into a user control, title
could be a property, the control could be cached, you could also include
other code global to your pages...CSS, script, META etc. ( 'tis what I
do )

hth

Matthew

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 10:23 AM
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

I tried that
Compiler Error Message: BC30456: 'Text' is not a member of
'System.Web.UI.HtmlControls.HtmlGenericControl'.

Hence the innerHTML bit but no banana on that one either.

-----Original Message-----
From: James Avery [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 16:08
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Try .Text

myTitle.Text =3D ""

-----Original Message-----
From: Damian Barrow [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 10:37 AM
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Sorry guys - still not getting this
Test page is:

<%@ Page Language=3D"VB" ContentType=3D"text/html"
ResponseEncoding=3D"iso-8859-1" %> <script language=3D"VB" =
runat=3D"server">
Public Sub Page_Load(Sender as Object, E as EventArgs)

Dim myTitle As HtmlGenericControl
myTitle =3D "Sir Barrow of Chorley"

End Sub
</script>
<html xmlns=3D"http://www.w3.org/1999/xhtml";>
<head>
<title id=3D"myTitle" runat=3D"server">notChanged</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Diso-8859-1"
/> </head> <body> </body> </html>

I get this error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Web.UI.HtmlControls.HtmlGenericControl'.

I've also tried myTitle.InnerText but no joy (I think my logic is
screwed there anyway. It must be doable as I've found some pages in
german and Thai that show how you can with codebehind, but not any with
inline code. It'd be awesome for search engine positiioning if I could
suss it.

Cheers
Damian

-----Original Message-----
From: Damian Barrow
Sent: 01 August 2002 14:30
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Dreamweaver doesn't rewrite it so woot!

Can I have that in vb please Ollie?

I've tried

Line 13: Public Sub Page_Load(Sender as Object, E as EventArgs) Line 14:

Line 15: protected HtmlGenericControl myTitle
Line 16: titleTag =3D "Sir Barrow of Chorley"
Line 17: end protected

But I get a BC30205: End of statement expected.

I'm looking now but this protected lark is uncharted terroritory for me
:)

-----Original Message-----
From: Ollie Cornes [mailto:Click here to reveal e-mail address]
Sent: 01 August 2002 14:11
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

Add an id attribute to the Title tag. Also add the runat=3D"server"
attribute.

<title runat=3D"server" id=3D"myTitle" />

Then from your code...

protected HtmlGenericControl myTitle;
...
myTitle =3D "Sir Barrow of Chorley";

You may find VS.NET keeps trashing the runat=3D"server" in your title =
tag.
VS.NET team - can you hear me, *please* *leave* *our* *html* *alone* :-)

Ollie

----- Original Message -----
From: "Damian Barrow" <Click here to reveal e-mail address>
To: "aspngclient" <Click here to reveal e-mail address>
Sent: Thursday, August 01, 2002 1:09 PM
Subject: [aspngclient] Can I dynamically set the TITLE tag of a page?

> -- Moved from [aspngfreeforall] to [aspngclient] by Tim Musschoot
<Click here to reveal e-mail address> --
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

Reply to this message...
 
    
Andy Smith
this is not a client issue.
this is a server-side issue.

__
Andy Smith
Keyboard Jockey #3a7-2.78.1

[Original message clipped]

Reply to this message...
 
    
dave
There is a really simple way to do this...

***title.aspx***
<%@ Page language="c#" Codebehind="title.aspx.cs" AutoEventWireup="false"
Inherits="test.title"%>
<html>
<head>
<title><%=strTitle%></title>
</head>
<body>
</body>
</html>

***title.aspx.cs***
...
public class title : System.Web.UI.Page
{
public String strTemp;
private void Page_Load(object sender, System.EventArgs e)
{
strTemp = "Dave's Test";
}
}
...

***VB Version***
***title.aspx.vb***

Public Class title
Inherits System.Web.UI.Page

Public strTitle as String

Private Sub Page_Load(ByVal sender as System.Object, ByVal e as
System.EventArgs)
strTitle = "Dave's Test"
End Sub

End Class

let me know if this works for you.

David

"Damian Barrow" <Click here to reveal e-mail address> wrote in message
news:692201@aspngclient...
[Original message clipped]

Reply to this message...
 
    
Damian Barrow
We've sussed this now, and while it's been mentioned to be OT, I'll
re-iterate the solution *if you're not a code behind fan* (which I'm
not)

Use a literal control instead.
However, for a more rounded, robust and scalable solution, wrapping the
literals in a control is a smart move. The ascx could draw its values
from database values in the aspx and you should have a fairly sound
search-engine friendly solution.

The reason for this being a client side issue (in my mind) is that the
rendered code is displayed to the SE spider as HTML, which is what I was
trying to get at. To further enhance the search engine experience, it'd
be nice to be able to create 3 different literals, each of which was
optimized for search engine tags.=20

Eg - in my page templates (DreamweaverMX and ASP.Matrix) I use
xxxtitlexxx, xxxdescxxx, xxxsearchxxx and xxxfulldescxxx. When I've
finished the page, I do a global replace on these terms which affect
such things as alt tags, hidden <hx> tags, comments, href's, noframe
tags etc. What I should have done at the start was to create common
elements such as images, title (ignore the meta bits - Google doesn't
use em) as a runat and set the alt/text/whatever value to a litera.=20

You can't expect a database to craft a search engine page for you but
the manual tweaking of 3 lines is acceptable to me.

Cheers for everyones input.
:D

-----Original Message-----
From: dave [mailto:Click here to reveal e-mail address]=20
Sent: 02 August 2002 20:56
To: aspngclient
Subject: [aspngclient] Re: Can I dynamically set the TITLE tag of a
page?

There is a really simple way to do this...

***title.aspx***
<%@ Page language=3D"c#" Codebehind=3D"title.aspx.cs"
AutoEventWireup=3D"false"
Inherits=3D"test.title"%>
<html>
<head>
<title><%=3DstrTitle%></title>
</head>
<body>
</body>
</html>

***title.aspx.cs***
...
public class title : System.Web.UI.Page
{
public String strTemp;
private void Page_Load(object sender, System.EventArgs e)
{
strTemp =3D "Dave's Test";
}
}
...

***VB Version***
***title.aspx.vb***

Public Class title
Inherits System.Web.UI.Page

Public strTitle as String

Private Sub Page_Load(ByVal sender as System.Object, ByVal e as
System.EventArgs)
strTitle =3D "Dave's Test"
End Sub

End Class

let me know if this works for you.

David

"Damian Barrow" <Click here to reveal e-mail address> wrote in message
news:692201@aspngclient...
[Original message clipped]

| [aspngclient] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/aspngclient.asp =3D JOIN/QUIT

_____________________________________________________________________
Travel Counsellors has scanned this message for all known viruses.

Reply to this message...
 
 
System.EventArgs
System.Object
System.Web.UI.HtmlControls.HtmlGenericControl
System.Web.UI.Page
System.Web.UI.WebControls.Literal




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com