Dynamic content problem

  • Thread starter Thread starter Griff
  • Start date Start date
G

Griff

I understand how to dynamically change the text of a label that appears in
the body tag by using code in the "code behind" page - one adds a <asp:label
id="labelToUpdate"/> tag.

However, I need to dynamically update the page title:
<html>
<head>
<title> <------------ !!!
</head>
</html>

VS2005 tells me that I can't place a <asp:label> here.

How do I achieve this?

Thanks

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

codebehind:

title.InnerText = "blah";


also, in 2.0, the @Page directive has a @title attribute, so you can
probably just do

Page.Title = "Heh";

karl
 
Okay

In my "base.master" file I've added:
<head runat="server">

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

</head>


Then in my code behind page want to change the title to be something from
the Request object, i.e.
pageTitle = CStr(Request("ApplicationPath"))

When I use the intermediate window, I can see what's in the Request object,
but when I try doing this in the page load event (or the page prerender
event) it's empty.

Griff
 
You need to set the InnerText property of the pageTitle object

pageTitle.InnerText = Request.ApplicationPath
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top