Here is how you can do it
define the <head> tag in the master page to be a server side control as
this :
<head runat="server">
Then in Page_Init event of master page add the following :
HtmlLink link = new HtmlLink();
link.Href = "~/column.js";
link.Attributes.Add("type", "text/javascript");
Page.Header.Controls.Add(link);
HTH !
--
Swanand Mokashi
Microsoft Certified Solution Developer (.NET) - Early Achiever
Microsoft Certified Application Developer (.NET)
http://www.dotnetgenerics.com/
DotNetGenerics.com -- anything and everything about Microsoft .NET
technology ...
http://www.swanandmokashi.com/ http://www.swanandmokashi.com/HomePage/WebServices/
Home of the Stock Quotes, Quote of the day and Horoscope web services
"Jianwei Sun" <js***********@gmail.com> wrote in message
news:um**************@TK2MSFTNGP02.phx.gbl...
Hi, Dear guru,
I have a question on embed a javascript into the master page.
I put the following line
<link runat="server" type="text/javascript" href="~/column.js" />
under the head, but obviously, it's not called anywhere.
But if I put this line,
<script type="text/javascript" src="column.js"></script>, it worked.
But I think i have to use the first approach since the second approach
will use an absolute path, and won't resolve in other pages which include
the master page.
Is there anyway around this issue
Thanks for help.