VS.NET removes "Runat=Server" without asking???

R

Ronald Colijn

HELP,

This is driving me crazy!

I have made a asp.net page and at the top I have this:

<HTML>
<HEAD>
<title id="PageTitle" runat="server">A Title</title>
<meta id="MetaDescription" name="description"
runat="server"></meta>
<meta id="MetaKeywords" name="keywords"
runat="server"></meta>
</HEAD>
...... rest of page

I have got this setup so I can fill in the page title
from a db. But every time when I open, change and save
the page VS.NET removes the runat="server" for the
<title> tag (not the rest).

Can anyone tell me why VS does this?

Thanks in advance!

Ronald Colijn

ps, it also changes the connection string to the db,
instead of using the web.config referal (dynamic
properties/connectionstring) it replaces referal to
web.config with the connectionstring. This is very
annoying also when I move the site to another server....

..
 
M

Martin Eklund

The answer has actually been posted before, but here it is again.

<title>
<asp:Literal id="PageTitle" runat="server" />
</title>

Also, you need to do the following change.

// before: protected System.Web.UI.HtmlControls.HtmlGenericControl PageTitle;
// after ...
protected System.Web.UI.WebControls.Literal PageTitle;


I also had to change to using "PageTitle.Text" instead of "PageTitle.InnerText".

Have fun!

/Martin
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top