Sorry for simple question:

  • Thread starter Thread starter Saravana
  • Start date Start date
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
 
..aspx.cs
protected string _title;
_title = "Hello";


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

MattC
 
VS.NET 2003 has a bug that will remove runat="server" from
the <title> element when switching from design to code views.
 
ehgads no...far better off to use the above suggestion, namely <title
runat="server" id="title" />

and

protected HtmlGenericControl title;


Karl
 
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 !
 
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
 
I use VS 2003 and runat="server" on my title tags with no problems, and I
constantly switch between design and code views.

Craig
 
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
 
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.
 
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
 
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
 
Back
Top