IE Title......

  • Thread starter Thread starter Amir Sen
  • Start date Start date
A

Amir Sen

Is it possible to dynamically change the IE title? After subsequent post
back of the same page I would like to change the IE title which is to be
read from a server side control (TextBox).

Thanks,

Amir
 
Is it possible to dynamically change the IE title? After subsequent post
back of the same page I would like to change the IE title which is to be
read from a server side control (TextBox).

Place a literal or label control in the <title></title> area of the
webpage.
 
Lucas,
I have the followinf code.
<title>
<% = txtCityName.Text %>
</title>

When the page loaded first time the city name is appearing in the title bar.
If the user changes the CityName(by search), search will resubmit the page
again and replaces the server side control(textbox) text property with the
latest city name search.
Title is not getting refreshed.
Thanks for your suggestions.
Gireesha
 
I've always used

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


codebehind:

protected HtmlGenericControl title;

void page_load(...){

title.innerText = "blah";
}

Karl
 
Hi,
Here is one way to do it: Give the title tag an id and add runat=server
attribute. Then access it from the code-behind using its id.

<title runAt=server id="pgTitle"></title>

From code behid:
pgTitle.InnerText = TextBox.Text;

Is it possible to dynamically change the IE title? After subsequent post
back of the same page I would like to change the IE title which is to be
read from a server side control (TextBox).

Thanks,

Amir
 
Now I am getting the following error message.

The server tag is not well formed.

Below are the codes.

HTML Code:
<title runat = "server" id="pgTitle"</title>

Code behind Code
Protected pgTitle As HtmlGenericControl

In the Page_Load event,
pgTitle.InnerText = txtCityName.Text

What is wrong with this code?
Thanks,
Amir
 
The opening title tag is missing the closing angular bracket '>' (after
"pgTitle").

Now I am getting the following error message.

The server tag is not well formed.

Below are the codes.

HTML Code:
<title runat = "server" id="pgTitle"</title>

Code behind Code
Protected pgTitle As HtmlGenericControl

In the Page_Load event,
pgTitle.InnerText = txtCityName.Text

What is wrong with this code?
Thanks,
Amir
 
Thanks for the suggestion on my Syntax error.
However my original problem still not resolved.

Here is my Code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then

'Load the data from database

pgTitle.InnerText = txtCityName.Text 'Works fine at this step

else

'User do city search

pgTitle.InnerText = txtCityName.Text 'Even though
pgTitle.InnerText is getting populated with the latest city name Title is
not reflecting the latest name

end if

End Sub

Thanks for your reply.
Amir

Shiva said:
The opening title tag is missing the closing angular bracket '>' (after
"pgTitle").

Now I am getting the following error message.

The server tag is not well formed.

Below are the codes.

HTML Code:
<title runat = "server" id="pgTitle"</title>

Code behind Code
Protected pgTitle As HtmlGenericControl

In the Page_Load event,
pgTitle.InnerText = txtCityName.Text

What is wrong with this code?
Thanks,
Amir
 
I had kept SmartNavigation = true for the page. Thats the reason title is
not getting refreshed after postbak. But anyone has any solution to this
problem with smartnavigation = true.
Thanks,
Gireesha




Amir Sen said:
Thanks for the suggestion on my Syntax error.
However my original problem still not resolved.

Here is my Code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then

'Load the data from database

pgTitle.InnerText = txtCityName.Text 'Works fine at this step

else

'User do city search

pgTitle.InnerText = txtCityName.Text 'Even though
pgTitle.InnerText is getting populated with the latest city name Title is
not reflecting the latest name

end if

End Sub

Thanks for your reply.
Amir

Shiva said:
The opening title tag is missing the closing angular bracket '>' (after
"pgTitle").

Now I am getting the following error message.

The server tag is not well formed.

Below are the codes.

HTML Code:
<title runat = "server" id="pgTitle"</title>

Code behind Code
Protected pgTitle As HtmlGenericControl

In the Page_Load event,
pgTitle.InnerText = txtCityName.Text

What is wrong with this code?
Thanks,
Amir
to
 
Back
Top