wallaceoc80
Programmer
I want to set the title of my page dynamically in ASP.NET.
I do this by giving the title tag an ID and including runat="server" as follows:
Then in my code behind file I do this:
This works fine except that every so often for no apparent reason when I build my solution it removes the runat="server" attribute from the title tag and I get an error.
Anybody know why this happens?
Thanks for your help,
Wallace
I do this by giving the title tag an ID and including runat="server" as follows:
Code:
<title id="PageTitle" runat="server"></title>
Then in my code behind file I do this:
Code:
string strTitle = cmdTitle.ExecuteScalar().ToString();
PageTitle.InnerText = strTitle;
This works fine except that every so often for no apparent reason when I build my solution it removes the runat="server" attribute from the title tag and I get an error.
Anybody know why this happens?
Thanks for your help,
Wallace