PDA

View Full Version : question about ~ for inline use in NavigateUrl property


hotwheelharry
08-06-2009, 03:10 AM
does anyone know how to put inline script into a html property, for example...

'<script type="text/javascript" src="<%=Eval("~/js/script.js");%>" ></script>'

this does not work when i run it.

I need the script source to pull script from the js folder in the app root because the page that this is running on is in 2 sub folders inside of app root.

That is why I was asking about "~" thing in urls, how can i use it inline?

HostingASPNet
08-06-2009, 07:42 PM
Hello,

You could use the full URL:

'<script type="text/javascript" src="<%=Eval("www.mysite.com/js/script.js");%>" ></script>'

Regards

pons_saravanan
08-17-2009, 04:20 PM
does anyone know how to put inline script into a html property, for example...

'<script type="text/javascript" src="<%=Eval("~/js/script.js");%>" ></script>'

this does not work when i run it.

I need the script source to pull script from the js folder in the app root because the page that this is running on is in 2 sub folders inside of app root.

That is why I was asking about "~" thing in urls, how can i use it inline?

you can write the script tag in code behind like this

page.registerclientscriptblock("script","<script type="text/javascript" src="+ page.resolveclienturl("~/js/script.js") +" ></script>"