Sorry for simple question:

N

Nils Magnus Englund

Hi Wardeaux,

Put a Web control between your <title> and </title> tags, then you could
reference that control from your codebehind to manipulate its output. (tip:
use the Literal web control)


Regards,
Nils Magnus Englund
 
M

MattC

..aspx.cs
protected string _title;
_title = "Hello";


..aspx
<head>
<title><%=_title%></title>
</head>

MattC
 
C

clintonG

VS.NET 2003 has a bug that will remove runat="server" from
the <title> element when switching from design to code views.
 
K

Karl Seguin

ehgads no...far better off to use the above suggestion, namely <title
runat="server" id="title" />

and

protected HtmlGenericControl title;


Karl
 
D

Davíð Þórisson

hey don't be sorry for asking this, this was also my first headache when
starting .Net and the reason is it requires quite a good knowledge of what's
really going on behind the curtains in .Net !
 
C

Craig

HTML for your aspx
<title id="PageTitle" runat="server">My Page Title</Title>

code behind
Dim title As HtmlContainerControl
title = DirectCast(FindControl("PageTitle"), HtmlContainerControl)
title.InnerText = "My New Page Title"

HTH
Craig
 
C

Craig

I use VS 2003 and runat="server" on my title tags with no problems, and I
constantly switch between design and code views.

Craig
 
C

clintonG

I'd say you were a lucky freak of nature :) as it happens to me
with regularity. There are discussions in newsgroups, forums, and
blogs that discovered and discuss this VS2003 bug.

<%= Clinton Gallagher
 
C

Craig

clintonG said:
I'd say you were a lucky freak of nature :) as it happens to me
with regularity.

As a good friend tells me all the time, luck is the residue of good design.
:) I have three development boxes on which I have never experienced this
bug. Do you have the Automatic Formatting and HTML Validation "features"
enabled for your html editor? I have mine turned off becuase quite frankly
they're stupid, and they wreck more than they fix.
 
K

Kevin Spencer

Uncle Chutney loves your friend's proverb:

"Luck is the residue of good design."

He asked me to let you know.

--
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
G

Gerry

You shouldn't be having trouble with this, but if you are - here's a
workaround:
declare a protected string in your codebehind with page scope
called, say, strTitle
Your title tag: <title><%=strTitle%></title> will render the
contents of this string which you can set anytime before page_unload.

Gerry
 

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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top