VS removing runat="server"

  • Thread starter Thread starter Libra Blue
  • Start date Start date
L

Libra Blue

I try to set the page title dynamically in an aspx page, but sometimes
an error occurs due to VS removing the runat="server" attribute at its
own will...
How do I stop from doing so??

Libra Blue
 
Libra Blue said:
I try to set the page title dynamically in an aspx page, but sometimes
an error occurs due to VS removing the runat="server" attribute at its
own will...
How do I stop from doing so??

Simple answer; you don't :/

Try using a LiteralControl between the <title></title>

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

in code then use

DynamicTitle.Text = "My Dynamic Title"



HTH
Brian W
 
Yes but when you go to edit it VS removes it when you switch to HTML view
and back.
This was a real pain.
I moved it to my base class that my pages inherit from.
Solved that problem!
 
Back
Top