Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Document title

Reply
Thread Tools

Document title

 
 
Tumurbaatar S.
Guest
Posts: n/a
 
      08-24-2005
How to change a document's title programmatically, from the Page_Load() for
example?


 
Reply With Quote
 
 
 
 
Grant Merwitz
Guest
Posts: n/a
 
      08-24-2005
you can either create a literal and set its text to:
<Title>Some TITLE</title>

Or, you can declare a public variable in your code like follows
public string PageTitle;

then in your Title tag do this:
<TITLE><%=PageTitle%></TITLE>

"Tumurbaatar S." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How to change a document's title programmatically, from the Page_Load()
> for example?
>



 
Reply With Quote
 
 
 
 
Tumurbaatar S.
Guest
Posts: n/a
 
      08-24-2005
Thank you!
There's no a special property/method to manipulate with a document title?
So, only way is to combine ASP.NET script and HTML tags.
I think that <%= PageTitle %> will assign initial value of the variable,
i.e. before
processing it within Page_Load(). May be it will work as I think:

<TITLE><%# PageTitle %></TITLE>
public string PageTitle;
Page_Load()
{
PageTitle = some_expression;
DataBind();
}

Am I right?


"Grant Merwitz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> you can either create a literal and set its text to:
> <Title>Some TITLE</title>
>
> Or, you can declare a public variable in your code like follows
> public string PageTitle;
>
> then in your Title tag do this:
> <TITLE><%=PageTitle%></TITLE>
>
> "Tumurbaatar S." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> How to change a document's title programmatically, from the Page_Load()
>> for example?
>>

>
>



 
Reply With Quote
 
Grant Merwitz
Guest
Posts: n/a
 
      08-24-2005
Sounds fine to me, never tested i though.

if you change the # to and =, you wouldn't have to use the Page.DataBind()
method.
But it should work fine

"Tumurbaatar S." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank you!
> There's no a special property/method to manipulate with a document title?
> So, only way is to combine ASP.NET script and HTML tags.
> I think that <%= PageTitle %> will assign initial value of the variable,
> i.e. before
> processing it within Page_Load(). May be it will work as I think:
>
> <TITLE><%# PageTitle %></TITLE>
> public string PageTitle;
> Page_Load()
> {
> PageTitle = some_expression;
> DataBind();
> }
>
> Am I right?
>
>
> "Grant Merwitz" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> you can either create a literal and set its text to:
>> <Title>Some TITLE</title>
>>
>> Or, you can declare a public variable in your code like follows
>> public string PageTitle;
>>
>> then in your Title tag do this:
>> <TITLE><%=PageTitle%></TITLE>
>>
>> "Tumurbaatar S." <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> How to change a document's title programmatically, from the Page_Load()
>>> for example?
>>>

>>
>>

>
>



 
Reply With Quote
 
Siva M
Guest
Posts: n/a
 
      08-24-2005
Another option:

....
<head>
<title id="pageTitle" runat=server></title>
</head>
....

In the code-behind:

pageTitle.InnerText = "Your page title goes here...";


"Tumurbaatar S." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
How to change a document's title programmatically, from the Page_Load() for
example?



 
Reply With Quote
 
Grant Merwitz
Guest
Posts: n/a
 
      08-24-2005
i was also thinking that.

But how do you declare the title in your code behind?
Vis studio doesn't add it automatically

"Siva M" <(E-Mail Removed)> wrote in message
news:uDYV%(E-Mail Removed)...
> Another option:
>
> ...
> <head>
> <title id="pageTitle" runat=server></title>
> </head>
> ...
>
> In the code-behind:
>
> pageTitle.InnerText = "Your page title goes here...";
>
>
> "Tumurbaatar S." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> How to change a document's title programmatically, from the Page_Load()
> for
> example?
>
>
>



 
Reply With Quote
 
Siva M
Guest
Posts: n/a
 
      08-24-2005
Hi,

Declare it as HtmlGenericControl.


"Grant Merwitz" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
i was also thinking that.

But how do you declare the title in your code behind?
Vis studio doesn't add it automatically

"Siva M" <(E-Mail Removed)> wrote in message
news:uDYV%(E-Mail Removed)...
> Another option:
>
> ...
> <head>
> <title id="pageTitle" runat=server></title>
> </head>
> ...
>
> In the code-behind:
>
> pageTitle.InnerText = "Your page title goes here...";
>
>
> "Tumurbaatar S." <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> How to change a document's title programmatically, from the Page_Load()
> for
> example?
>
>
>




 
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
I'm looking for html cleaner. Example : convert <h1><span><font>my title</font></span></h1> => <h1>my title</h1>… Stéphane Klein Python 2 03-30-2010 12:35 AM
Friendly Urls with page title in (eg. page-title.aspx) anthonykallay@googlemail.com ASP .Net 1 04-24-2007 08:25 AM
How 2 place page title into window title using sitemap in master page? bednar.tomas@gmail.com ASP .Net 0 11-30-2006 03:17 PM
Does anyone know the title of the first ever DVD title released? (UK/US) Mikey DVD Video 12 09-23-2006 07:14 PM
Fastest way to get a the string between <title> </title> Andreas Klemt ASP .Net 1 08-10-2003 01:58 AM



Advertisments