Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relative script path in usercontrol

I have asp.net usercontrol that is including some js script like this

<script type="text/javascript" language="javascript" src="../JScripts/JScripts.js"/>

The problem is that when I am using this usercontrol in some pages, it works correctly, but when using some pages in another folder structure, it fails with the file not found exception message. Changing js path to

~/JScripts/JScripts.js

doesn't help. is there any way to solve this problem decoratively?

like image 234
Arsen Mkrtchyan Avatar asked Apr 13 '26 03:04

Arsen Mkrtchyan


1 Answers

EDITED:

you always have the option of doing something like this:

<script type="text/javascript" language="javascript" src="<%= ResolveClientUrl("~/JScripts/JScripts.js") %>" />
like image 168
Veli Gebrev Avatar answered Apr 14 '26 17:04

Veli Gebrev