VS2003 removing "Runat" attribute from <title>

B

Brad

I'm placing a runat=server attribute on the <title> tag in my pages, so I
can read/set the title text in code. The problem is that when I
subsequently change the page in design view VS is removing the runat=server
from the <title> tag. Unfortunately it does not do it all the time...maybe
50%.


Brad
 
M

Marina

I think that is just something it does unfortunately. You would either have
to keep fixing it, or keep the page in HTML view.
 
J

Jacob Munk-Stander

Hi,
set the runat="server" on the <head> tag and set the Title attribute as you
wish.
 
G

Greg Burns

I've read about people using a placeholder instead, but I've can't seem to
figure out how to remove the <span> tags that appear in my example...
Anybody?

<title>
<asp:placeHolder id="ph" runat="server" />
</title>


Protected ph As WebControls.PlaceHolder

Page_Load...
Dim mylabel As New System.Web.UI.WebControls.Label
mylabel.Text = "My Title"
ph.Controls.Add(myLabel)

Greg
 
J

Jacob Munk-Stander

Sorry, I was working in Whidbey where this worked like a charm.

You could add a literal control to your <title> and assign the Text value of
it as you wish:
---
<head>

<title><asp:literal runat="server" id="litTitle"></asp:literal></title>

</head>

---

void Page_Load(object sender, EventArgs e)

{

litTitle.Text = "Hello, Title!";

}
 
G

Greg Burns

Now that's what I was thinking of!

Jacob Munk-Stander said:
Sorry, I was working in Whidbey where this worked like a charm.

You could add a literal control to your <title> and assign the Text value of
it as you wish:
---
<head>

<title><asp:literal runat="server" id="litTitle"></asp:literal></title>

</head>

---

void Page_Load(object sender, EventArgs e)

{

litTitle.Text = "Hello, Title!";

}
 
J

Joe Fallon

Yep.
Happened to me too.
Real pain.

I added it to my Base class and that took care of that problem.
It is not in the designer any more.
 

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

Staff online

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top