473,385 Members | 1,402 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,385 software developers and data experts.

Sorry for simple question:

OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux
Nov 18 '05 #1
13 1138
Check out this faq,
http://authors.aspalliance.com/kenc/faq5.aspx

-Saravana
www.ExtremeExperts.com

"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux

Nov 18 '05 #2
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

"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux

Nov 18 '05 #3
..aspx.cs
protected string _title;
_title = "Hello";
..aspx
<head>
<title><%=_title%></title>
</head>

MattC
"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux

Nov 18 '05 #4
VS.NET 2003 has a bug that will remove runat="server" from
the <title> element when switching from design to code views.

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux

Nov 18 '05 #5
ehgads no...far better off to use the above suggestion, namely <title
runat="server" id="title" />

and

protected HtmlGenericControl title;
Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"MattC" <m@m.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
.aspx.cs
protected string _title;
_title = "Hello";
.aspx
<head>
<title><%=_title%></title>
</head>

MattC
"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux


Nov 18 '05 #6
Check out:
http://aspnet101.com/titlechange.asp...tlechange.aspx

David Wier
MCP, MVP ASP.NET, ASPInsider
http://aspnet101.com
http://aspexpress.com
"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux

Nov 18 '05 #7
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 !

"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux

Nov 18 '05 #8
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

"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux

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

Craig

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
VS.NET 2003 has a bug that will remove runat="server" from
the <title> element when switching from design to code views.

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux


Nov 18 '05 #10
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
"Craig" <us**@domain.com> wrote in message
news:Dg*******************@tornado.tampabay.rr.com ...
I use VS 2003 and runat="server" on my title tags with no problems, and I
constantly switch between design and code views.

Craig

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
VS.NET 2003 has a bug that will remove runat="server" from
the <title> element when switching from design to code views.

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
OK... how do I set the aspx page html title from my codebehind?
MTIA
wardeaux



Nov 18 '05 #11

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Iz*****************@twister.rdc-kc.rr.com...
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.
Nov 18 '05 #12
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

"Craig" <us**@domain.com> wrote in message
news:kh******************@tornado.tampabay.rr.com. ..

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:Iz*****************@twister.rdc-kc.rr.com...
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.

Nov 18 '05 #13
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

"Craig" <us**@domain.com> wrote in message
news:Dg*******************@tornado.tampabay.rr.com ...
I use VS 2003 and runat="server" on my title tags with no problems, and I
constantly switch between design and code views.

Craig

"clintonG" <cs*********@REMOVETHISTEXTmetromilwaukee.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
VS.NET 2003 has a bug that will remove runat="server" from
the <title> element when switching from design to code views.

--
<%= Clinton Gallagher, "Twice the Results -- Half the Cost"
Architectural & e-Business Consulting -- Software Development
NET cs*********@REMOVETHISTEXTmetromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"Wardeaux" <wa******@bellsouth.net> wrote in message
news:Ou**************@TK2MSFTNGP14.phx.gbl...
> OK... how do I set the aspx page html title from my codebehind?
> MTIA
> wardeaux
>
>



Nov 18 '05 #14

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

Similar topics

15
by: Peroq | last post by:
Hi all I'm not sure ASP is the problem, but my SQL statement seems fine to me. This works fine : strSQL = "SELECT .* FROM _RechPat INNER JOIN NivPatri ON .cod_niv = NivPatri.cod_niv WHERE...
1
by: Tony Vasquez | last post by:
First off, I am coding soley for IE 5.5+ right now. I am going to try to later add code for other support of other browsers, but I doubt it will ever support more than a few. The site is up at...
6
by: John Wiese | last post by:
I am creating my first website and need some help desperatley. I have choosen to use Front Page XP for this simple Intranet project. All I am trying to do is: 1. Collect childrens names for a...
3
by: David Sworder | last post by:
This message was already cross-posted to C# and ADO.NET, but I forgot to post to this "general" group... sorry about that. It just occured to me after my first post that the "general" group readers...
18
by: Xiangliang Meng | last post by:
Hi. void setValue(int n) { int size = getValueLength(); int buffer_p; if (buffer_p) { ....
11
by: sneill | last post by:
I have read a number of posts on the use of eval() in Javascript, and I agree that its use is questionable. But it does beg the following question: "How arbitrary does a string need to be before...
5
by: Brian | last post by:
I am "learning" C# and have run into a problem that, though I can work around it, I would like to know what the *right* way to handle the issue is. I have created an "Info" struct and assigned...
2
by: Colin McGuire | last post by:
Sorry to ask a simple question on syntax but the line inside the subroutine "assignBitmapArray" won't compile giving me an "Expression Expected" error. What is the correct syntax to initialize an...
5
by: Wardeaux | last post by:
All, How do I start another exe from my vb desktop app? want to create simple setup wrapper that calls several setups in sequence... MTIA wardeaux
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.