Kevin.

There are a couple of work-arounds, nether of them very compelling.

The following  works on my computer and I still have the defaults for
Tools/Options/Text Editor/HTML//Format/Apply Automatic Formatting set to
True.

Workaround 1
1. Switch to HTML view and type your tag - <title runat="server"
id="titleElement">here</title>
2. Save your aspx page.
3. Now it is safe to switch between design view and HTML view.
4. Note:  if you make any changes in your html you must save again
before switching to design view or VS.NET will hammer your code again.
Also if you edit anything in the design view you will lose the runat=
server attribute.

Workaround 2
This one solves your problem and you don't need to use the title tag
with the runat=server attribute.
1. Use a literal control in the title.
<title><asp:literal id = 'literal1' runat ='server'/></title>
2. Switch to your code behind page.  Since the literal tag is not in
located between the form tags VS.NET will not automatically create a
variable declaration.
3.  Add a declare that matches the name of your literal.
Protected Withevents Literal1 as Literal
4. You should be able to modify the properties of the literal control
now.
Me.Literal.Text = TimeOfDay


Walt Ritscher

-----Original Message-----
From: dotnet discussion [mailto:[EMAIL PROTECTED]] On Behalf Of
Kevin Hector
Sent: Wednesday, May 15, 2002 12:55 PM
To: [EMAIL PROTECTED]
Subject: [DOTNET] Stop VS.NET mucking with my HTML


In ASP.NET I need to set the TITLE text of the HEAD element at runtime,
so I have added the following:

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

and I have hooked up an HtmlGenericControl to do the runtime setting,
which works great. However, in a disturbing throwback to MS Frontpage
(eek!) days I find that VS.NET HTML editor likes to delete the
'runat=server' bit when I save the page, because presumably it thinks I
typed it in error.

Any workarounds, or is it time to reconsider notepad as the html editor
of choice :(

Kevin Hector


_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp.

You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to