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

<TITLE>

Is there a way to manipulate the <TITLEin the csharp code?

Nov 6 '06 #1
15 1872
"Steve B" <St****@discussions.microsoft.comwrote in message
news:59**********************************@microsof t.com...
Is there a way to manipulate the <TITLEin the csharp code?
The "<TITLE>" of what? Since "<TITLE>" by itself isn't valid C# syntax, you
must be using that to refer to something else. To what are you referring?

If you are talking about the text displayed in the title bar of the form,
then all you have to do is set the "Text" property of the form instance. If
you're talking about something else, you need to be more specific about what
it is you want to do.

Pete
Nov 6 '06 #2


"Peter Duniho" <Np*********@NnOwSlPiAnMk.comwrote in message
news:12*************@corp.supernews.com...
"Steve B" <St****@discussions.microsoft.comwrote in message
news:59**********************************@microsof t.com...
>Is there a way to manipulate the <TITLEin the csharp code?

The "<TITLE>" of what? Since "<TITLE>" by itself isn't valid C# syntax,
you must be using that to refer to something else. To what are you
referring?

If you are talking about the text displayed in the title bar of the form,
then all you have to do is set the "Text" property of the form instance.
If you're talking about something else, you need to be more specific about
what it is you want to do.

Pete
<TITLEis html markup for the title element in aspx (or basically, html).
There is no direct way of accessing the title element from the code-behind,
and was kinda buggy using the workarounds provided on the net (such as
giving the Title id and runat attributes). What you can do (and what we
have done) is put server side script inside the <titleblock, such as the
following:

<title><%=this.PageTitle%></title>

Inside your page (or base classes that your page inherits from) is provide
the PageTitle property that the server-side script is accessing.

HTH,
Mythran
Nov 6 '06 #3
Mythran,
Can you also send me some sample C# code on how to do this?

Are there any special "using System...." I need to add

Thanks for your help.

"Mythran" wrote:
>

"Peter Duniho" <Np*********@NnOwSlPiAnMk.comwrote in message
news:12*************@corp.supernews.com...
"Steve B" <St****@discussions.microsoft.comwrote in message
news:59**********************************@microsof t.com...
Is there a way to manipulate the <TITLEin the csharp code?
The "<TITLE>" of what? Since "<TITLE>" by itself isn't valid C# syntax,
you must be using that to refer to something else. To what are you
referring?

If you are talking about the text displayed in the title bar of the form,
then all you have to do is set the "Text" property of the form instance.
If you're talking about something else, you need to be more specific about
what it is you want to do.

Pete

<TITLEis html markup for the title element in aspx (or basically, html).
There is no direct way of accessing the title element from the code-behind,
and was kinda buggy using the workarounds provided on the net (such as
giving the Title id and runat attributes). What you can do (and what we
have done) is put server side script inside the <titleblock, such as the
following:

<title><%=this.PageTitle%></title>

Inside your page (or base classes that your page inherits from) is provide
the PageTitle property that the server-side script is accessing.

HTH,
Mythran
Nov 6 '06 #4
Hi Mythran,

In VS 2005 you can set a page's title in code using the Title property of the
Page object.

The property requires that a header control is present on the page, which is
added by VS 2005 when a new web page is created in the IDE. If you need to
add one yourself here is the basic html:

<html>
<head runat="server"></head <!-- required by Title property -->
<body>...</body>
</html>

HTH

--
Dave Sexton

"Mythran" <ki********@hotmail.comwrote in message
news:OE**************@TK2MSFTNGP04.phx.gbl...
>

"Peter Duniho" <Np*********@NnOwSlPiAnMk.comwrote in message
news:12*************@corp.supernews.com...
>"Steve B" <St****@discussions.microsoft.comwrote in message
news:59**********************************@microso ft.com...
>>Is there a way to manipulate the <TITLEin the csharp code?

The "<TITLE>" of what? Since "<TITLE>" by itself isn't valid C# syntax,
you must be using that to refer to something else. To what are you
referring?

If you are talking about the text displayed in the title bar of the form,
then all you have to do is set the "Text" property of the form instance. If
you're talking about something else, you need to be more specific about
what it is you want to do.

Pete

<TITLEis html markup for the title element in aspx (or basically, html).
There is no direct way of accessing the title element from the code-behind,
and was kinda buggy using the workarounds provided on the net (such as
giving the Title id and runat attributes). What you can do (and what we
have done) is put server side script inside the <titleblock, such as the
following:

<title><%=this.PageTitle%></title>

Inside your page (or base classes that your page inherits from) is provide
the PageTitle property that the server-side script is accessing.

HTH,
Mythran


Nov 6 '06 #5
Hi,

Mythran wrote:
<TITLEis html markup for the title element in aspx (or basically,
html). There is no direct way of accessing the title element from the
code-behind, and was kinda buggy using the workarounds provided on the
net (such as giving the Title id and runat attributes). What you can do
(and what we have done) is put server side script inside the <title>
block, such as the following:

<title><%=this.PageTitle%></title>

Inside your page (or base classes that your page inherits from) is
provide the PageTitle property that the server-side script is accessing.

HTH,
Mythran
Just wondering, what kind of problems did you get setting

<title runat="server" id="pageTitle">Default title</title>

and accessing the control in the code-behind? It works pretty well for me.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 6 '06 #6


"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:et**************@TK2MSFTNGP03.phx.gbl...
Hi Mythran,

In VS 2005 you can set a page's title in code using the Title property of
the Page object.

The property requires that a header control is present on the page, which
is added by VS 2005 when a new web page is created in the IDE. If you
need to add one yourself here is the basic html:

<html>
<head runat="server"></head <!-- required by Title property -->
<body>...</body>
</html>

HTH

--
Dave Sexton

"Mythran" <ki********@hotmail.comwrote in message
news:OE**************@TK2MSFTNGP04.phx.gbl...
>>

"Peter Duniho" <Np*********@NnOwSlPiAnMk.comwrote in message
news:12*************@corp.supernews.com...
>>"Steve B" <St****@discussions.microsoft.comwrote in message
news:59**********************************@micros oft.com...
Is there a way to manipulate the <TITLEin the csharp code?

The "<TITLE>" of what? Since "<TITLE>" by itself isn't valid C# syntax,
you must be using that to refer to something else. To what are you
referring?

If you are talking about the text displayed in the title bar of the
form, then all you have to do is set the "Text" property of the form
instance. If you're talking about something else, you need to be more
specific about what it is you want to do.

Pete

<TITLEis html markup for the title element in aspx (or basically,
html). There is no direct way of accessing the title element from the
code-behind, and was kinda buggy using the workarounds provided on the
net (such as giving the Title id and runat attributes). What you can do
(and what we have done) is put server side script inside the <title>
block, such as the following:

<title><%=this.PageTitle%></title>

Inside your page (or base classes that your page inherits from) is
provide the PageTitle property that the server-side script is accessing.

HTH,
Mythran


That's sweet Dave. Although, in Visual Studio .Net 2003 and below, adding a
runat="server" on the title attribute, as stated, will be removed by the IDE
intermitantly. It's nice that it works in .Net 2k5 now ... if it does
indeed work that way :)

Nov 6 '06 #7


"Steve B" <St****@discussions.microsoft.comwrote in message
news:CB**********************************@microsof t.com...
Mythran,
Can you also send me some sample C# code on how to do this?

Are there any special "using System...." I need to add

Thanks for your help.

"Mythran" wrote:
>>
You may want to check Dave Sexton's reply...but to do it using the way I
presented (if you are using < .Net 2k5):

public class MyPage : Page
{
// ...
public string PageTitle
{
get { return "Some title"; }
}
// ...
}

HTH,
Mythran
Nov 6 '06 #8
Hi Mythran,

Yes, it's a welcomed addition.

--
Dave Sexton

"Mythran" <ki********@hotmail.comwrote in message
news:ev**************@TK2MSFTNGP03.phx.gbl...
>

"Dave Sexton" <dave@jwa[remove.this]online.comwrote in message
news:et**************@TK2MSFTNGP03.phx.gbl...
>Hi Mythran,

In VS 2005 you can set a page's title in code using the Title property of
the Page object.

The property requires that a header control is present on the page, which
is added by VS 2005 when a new web page is created in the IDE. If you need
to add one yourself here is the basic html:

<html>
<head runat="server"></head <!-- required by Title property -->
<body>...</body>
</html>

HTH

--
Dave Sexton

"Mythran" <ki********@hotmail.comwrote in message
news:OE**************@TK2MSFTNGP04.phx.gbl...
>>>

"Peter Duniho" <Np*********@NnOwSlPiAnMk.comwrote in message
news:12*************@corp.supernews.com...
"Steve B" <St****@discussions.microsoft.comwrote in message
news:59**********************************@micro soft.com...
Is there a way to manipulate the <TITLEin the csharp code?

The "<TITLE>" of what? Since "<TITLE>" by itself isn't valid C# syntax,
you must be using that to refer to something else. To what are you
referring?

If you are talking about the text displayed in the title bar of the form,
then all you have to do is set the "Text" property of the form instance.
If you're talking about something else, you need to be more specific
about what it is you want to do.

Pete
<TITLEis html markup for the title element in aspx (or basically, html).
There is no direct way of accessing the title element from the
code-behind, and was kinda buggy using the workarounds provided on the net
(such as giving the Title id and runat attributes). What you can do (and
what we have done) is put server side script inside the <titleblock,
such as the following:

<title><%=this.PageTitle%></title>

Inside your page (or base classes that your page inherits from) is provide
the PageTitle property that the server-side script is accessing.

HTH,
Mythran



That's sweet Dave. Although, in Visual Studio .Net 2003 and below, adding a
runat="server" on the title attribute, as stated, will be removed by the IDE
intermitantly. It's nice that it works in .Net 2k5 now ... if it does
indeed work that way :)

Nov 6 '06 #9


"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:Om**************@TK2MSFTNGP02.phx.gbl...
Hi,

Mythran wrote:
><TITLEis html markup for the title element in aspx (or basically,
html). There is no direct way of accessing the title element from the
code-behind, and was kinda buggy using the workarounds provided on the
net (such as giving the Title id and runat attributes). What you can do
(and what we have done) is put server side script inside the <title>
block, such as the following:

<title><%=this.PageTitle%></title>

Inside your page (or base classes that your page inherits from) is
provide the PageTitle property that the server-side script is accessing.

HTH,
Mythran

Just wondering, what kind of problems did you get setting

<title runat="server" id="pageTitle">Default title</title>

and accessing the control in the code-behind? It works pretty well for me.

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
In < .Net 2k5, the ide removes the runat and id attributes, intermitantly...

Mythran
Nov 6 '06 #10
In ASP.NET 2.0, the Page class has a Title property. That's about all you
need to know. For ASP.NET 1.1, you would need to make it a runat=Server tag
so that you can access it from the codebehind.

This is really an asp.net group topic though, not a c# language issue.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Steve B" wrote:
Is there a way to manipulate the <TITLEin the csharp code?
Nov 6 '06 #11


"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:25**********************************@microsof t.com...
In ASP.NET 2.0, the Page class has a Title property. That's about all you
need to know. For ASP.NET 1.1, you would need to make it a runat=Server
tag
so that you can access it from the codebehind.

This is really an asp.net group topic though, not a c# language issue.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Steve B" wrote:
>Is there a way to manipulate the <TITLEin the csharp code?
ASP.Net 1.1 removes the runat and id attributes on the title element.

HTH,
Mythran
Nov 6 '06 #12
Hi,

Mythran wrote:
>

"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:Om**************@TK2MSFTNGP02.phx.gbl...
>Just wondering, what kind of problems did you get setting

<title runat="server" id="pageTitle">Default title</title>

and accessing the control in the code-behind? It works pretty well for
me.

HTH,
Laurent

In < .Net 2k5, the ide removes the runat and id attributes,
intermitantly...

Mythran
Interesting. We used that in our ASP.NET 1.1 application, never had any
problem with it. Did you use the HTML designer?

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 7 '06 #13


"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:ui**************@TK2MSFTNGP03.phx.gbl...
Hi,

Mythran wrote:
>>

"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:Om**************@TK2MSFTNGP02.phx.gbl...
>>Just wondering, what kind of problems did you get setting

<title runat="server" id="pageTitle">Default title</title>

and accessing the control in the code-behind? It works pretty well for
me.

HTH,
Laurent

In < .Net 2k5, the ide removes the runat and id attributes,
intermitantly...

Mythran

Interesting. We used that in our ASP.NET 1.1 application, never had any
problem with it. Did you use the HTML designer?

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Yup. That's the part of the ide that removes the attributes from the title
element.

Mythran
Nov 7 '06 #14
Hi,

Mythran wrote:
>

"Laurent Bugnion" <ga*********@bluewin.chwrote in message
news:ui**************@TK2MSFTNGP03.phx.gbl...
>>
Interesting. We used that in our ASP.NET 1.1 application, never had
any problem with it. Did you use the HTML designer?

Greetings,
Laurent

Yup. That's the part of the ide that removes the attributes from the
title element.

Mythran
OK, everything is clear now. The designer in 1.1 was so messed up that
we explicitly forbade our developers to use it.

Greetings,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch
Nov 7 '06 #15
Then just put in an aspLiteral control in betwee the <TITLE</TITLEtags
and use that.
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mythran" wrote:
>

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:25**********************************@microsof t.com...
In ASP.NET 2.0, the Page class has a Title property. That's about all you
need to know. For ASP.NET 1.1, you would need to make it a runat=Server
tag
so that you can access it from the codebehind.

This is really an asp.net group topic though, not a c# language issue.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Steve B" wrote:
Is there a way to manipulate the <TITLEin the csharp code?

ASP.Net 1.1 removes the runat and id attributes on the title element.

HTH,
Mythran
Nov 7 '06 #16

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

Similar topics

13
by: mark | last post by:
IF I have something like this: <title><?php print($pagetitle); ?></title> <body> <?php include("folders/my_include.php"); ?> </body> </html> and my_include.php contains the value to the...
5
by: Info 3000 | last post by:
Hi there, Simple question, but headache ! I have a PHP Page like : <HTML> <HEAD> <TITLE>Sunny day !</TITLE> </HEAD>
3
by: D. Alvarado | last post by:
Hello, I am trying to find the <TITLE> element of my document. Normally alert(document.title); works just fine, but when this statement is within a page that is a frame in a larger document,...
2
by: Irene | last post by:
Hi, I would like to modify the text within an html title tag based upon a value read from the registry (or the existence of a certain file). For example, if a certain registry value is equal...
1
by: Andreas Klemt | last post by:
Hello, I have in my strHtml a html page. so what is the fastest way (with XML Read?) to get the "myValue" between <title>myValue</title> Thanks, Andreas
6
by: Alex | last post by:
Hi, is it possible to set the title programatically from the code behind page. I placed a literal in the head section of the form and set its text property. it seemed to work bu the literal...
8
by: DC | last post by:
In HTML page, I put: <html> <head> <title>Article: <asp:Label ID="lblHTMLTitle"></asp:Label> </title> .... In the code behind: ....
1
by: Alan Silver | last post by:
Hello, I am just experimenting with master pages, and am trying to add a content placeholder in the <head> section, so that individual pages can set their own page title and meta tags. The...
4
by: David Thielen | last post by:
Hi; If I am using master pages, how do I set the <title> and <meta name='description' content='my title'> for each page. Obviously each page will have a different title & description. --...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.