Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Changing the document.title from a user control

Reply
Thread Tools

Changing the document.title from a user control

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      05-23-2005
I would like to change the <title></title> of a page from a user control. I
have been unable to find any property in VB that allows me to do this. The
only thing I have been able to find that might be related is when in Design
view, there is a property called title under the DOCUMENT object in
properties, which leads me to believe that there may be a way to access a
DOCUMENT.title somewhere (although that may be only for Javascript/JScript).
Does anyone know of a way to change the document title programmatically
using VB.NET in ASP.NET from a User Control? Thanks.
--
Nathan Sokalski

http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      05-23-2005
Nathan,

Not the nicest stuff, although I am busy again at the moment with it.
(Don't set imports to this namespace).

http://msdn.microsoft.com/library/de.../reference.asp

It follows completly the DOM

I hope this helps,

Cor


 
Reply With Quote
 
 
 
 
Ken Tucker [MVP]
Guest
Posts: n/a
 
      05-23-2005
Hi,

To be able to change the page title from an asp.net application add the
following to html portion of the aspx.

<HEAD>
<title runat="server" id="PageTitle"></title>
......
</HEAD>

Note that if you make changes to the web page vb.net will drop the
runat=server. Make sure you add it back in or you wont be able to change the
page title

Add the following to the aspx.vb file

Protected PageTitle as new htmlgenericcontrol

To change the page title from the page

PageTitle.InnerText= "My new page title"

To access this from a user control

Dim pagetitle as htmlgenericcontrol

Try
pagetitle=ctype(me.page.findcontrol("PageTitle"), htmlgenericcontrol)
pagetitle.innertext="Live from user control"
catch
end try

Ken
------------------------

"Nathan Sokalski" wrote:

> I would like to change the <title></title> of a page from a user control. I
> have been unable to find any property in VB that allows me to do this. The
> only thing I have been able to find that might be related is when in Design
> view, there is a property called title under the DOCUMENT object in
> properties, which leads me to believe that there may be a way to access a
> DOCUMENT.title somewhere (although that may be only for Javascript/JScript).
> Does anyone know of a way to change the document title programmatically
> using VB.NET in ASP.NET from a User Control? Thanks.
> --
> Nathan Sokalski
>
> http://www.nathansokalski.com/
>
>
>

 
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
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
Event not firing for user control inside user control vatech1993 ASP .Net 4 12-11-2004 02:51 PM
Difficulty in changing the Connection Server control path changing ... Samridhi Kumar Shukla ASP .Net 1 11-30-2003 02:31 AM
Manipulating a User Control from another User Control Tom Rowton ASP .Net 2 08-01-2003 08:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57