1

I have a user control that contains a notification icon when I use mouseover event on that icon notification list displayed with a scrollbar like the one of Facebook. I used a custom scrollbar from below link:

http://baijs.nl/tinyscrollbar/

I added path of .js file which is used in this link to my user control page

I used this user control to master page and many other web pages of my project but scrollbar is not working

when I added this path of js in each pages then scrollbar it's working but there are many pages I can't give path in.

How should I solve this?

Edit 1

Tried

 <link href='<%= ResolveUrl("~/assets/css/website.css") %>' rel="stylesheet" type="text/css" />
 <script type="text/javascript" src='<%= ResolveUrl("~/assets/js/homebanner/jquery.tinyscrollbar.min.js") %>'></script>
शेखर
  • 17,412
  • 13
  • 61
  • 117
Diva
  • 15
  • 2

2 Answers2

0

use resolve url to include the file
<%= ResolveUrl("~/fielName.js") %>;

<link href='<%= ResolveUrl(~/styles/MyStyles.css") %>' rel="stylesheet" type="text/css" />
<script type="text/javascript" src='<%= ResolveUrl("~/scripts/MyJScript.js")' %>">

Add you file in master page.
And use file path as above.

Other wise you will have to give the full path like

 <script type="text/javascript" src="http://yoursite/scripts/MyJScript.js">
शेखर
  • 17,412
  • 13
  • 61
  • 117
-2

I solved this using ScriptCombiner. I saved path of javascript file(~/assets/js/homebanner/jquery.tinyscrollbar.min.js) in notepad and added to App_Data folder also added JavaScriptMinifier.cs and JavaScriptMinifier.cs to App_Code folder. Finally I added <%= ScriptCombiner.GetScriptTags("Site_Scripts", 2)%> to my user control page and master page and removed from user control.

Diva
  • 15
  • 2