Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Reading Page Title?

Reply
Thread Tools

Reading Page Title?

 
 
Chad A. Beckner
Guest
Posts: n/a
 
      06-03-2004
Does anyone know how to read the page title the executing page, using
ASP.NET? I thought that this could be accessed using the Controls
collection, but I can't seem to figure it out.

Thanks!

Chad


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      06-03-2004
unless you put runat=server on the title tag in the html, it will be inside
one the literals in the page controls collection.

-- bruce (sqlwork.com)


"Chad A. Beckner" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Does anyone know how to read the page title the executing page, using
> ASP.NET? I thought that this could be accessed using the Controls
> collection, but I can't seem to figure it out.
>
> Thanks!
>
> Chad
>
>



 
Reply With Quote
 
 
 
 
Chad A. Beckner
Guest
Posts: n/a
 
      06-03-2004
Ok, any idea of how to access this?

Chad

"bruce barker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> unless you put runat=server on the title tag in the html, it will be

inside
> one the literals in the page controls collection.
>
> -- bruce (sqlwork.com)
>
>
> "Chad A. Beckner" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > Does anyone know how to read the page title the executing page, using
> > ASP.NET? I thought that this could be accessed using the Controls
> > collection, but I can't seem to figure it out.
> >
> > Thanks!
> >
> > Chad
> >
> >

>
>



 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      06-03-2004
"Chad A. Beckner" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Does anyone know how to read the page title the executing page, using
> ASP.NET? I thought that this could be accessed using the Controls
> collection, but I can't seem to figure it out.


You have to use:

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

Then in your code you can access myTitle.InnerText to get the text.

If a given page doesn't have a <title> with runat="server", then there is no
way to retrieve the page title (if there is one).
--
John Saunders
johnwsaundersiii at hotmail


 
Reply With Quote
 
Chad A. Beckner
Guest
Posts: n/a
 
      06-03-2004
But that won't work on static .htm files. I also need to access the meta
tags (since my site template .ascx file is generating the <head> element).
Ideas?

Chad

"John Saunders" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "Chad A. Beckner" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Does anyone know how to read the page title the executing page, using
> > ASP.NET? I thought that this could be accessed using the Controls
> > collection, but I can't seem to figure it out.

>
> You have to use:
>
> <head>
> <title runat="server" id="myTitle">Page title</title>
> </head>
>
> Then in your code you can access myTitle.InnerText to get the text.
>
> If a given page doesn't have a <title> with runat="server", then there is

no
> way to retrieve the page title (if there is one).
> --
> John Saunders
> johnwsaundersiii at hotmail
>
>



 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      06-03-2004
"Chad A. Beckner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> But that won't work on static .htm files. I also need to access the meta
> tags (since my site template .ascx file is generating the <head> element).
> Ideas?


You can't do it.
--
John Saunders
johnwsaundersiii at hotmail


 
Reply With Quote
 
Saravana [MVP]
Guest
Posts: n/a
 
      06-04-2004
Check out this article this might help you,
http://authors.aspalliance.com/kenc/faq5.aspx

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com



"Chad A. Beckner" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Does anyone know how to read the page title the executing page, using
> ASP.NET? I thought that this could be accessed using the Controls
> collection, but I can't seem to figure it out.
>
> Thanks!
>
> Chad
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading a file and resuming reading. Karim Ali Python 2 05-25-2007 02:04 PM
UnauthorizedAccessException when reading XML files (no problem when reading other file-types) blabla120@gmx.net ASP .Net 0 09-15-2006 02:08 PM
DVD ROM not reading DVDs but reading CDs sayeed.afzal@gmail.com Computer Information 0 05-22-2006 10:37 AM
ASP.NET Reading problem (reading .xls) Wael Soliman ASP .Net 2 01-03-2005 05:33 PM
reading the DB vs. reading a text file...performance preference? Darrel ASP .Net 3 11-11-2004 02:27 PM



Advertisments