Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Javascript problem in Custom Webcontrol

Reply
Thread Tools

Javascript problem in Custom Webcontrol

 
 
New User
Guest
Posts: n/a
 
      12-02-2003
I have following structure for my project


myproj
Controls/control1
morepages/special.aspx
specialpages/webpage1.aspx
scripts/filename.js
default.aspx



I have a control1 which has a public property name
ScriptFilePath for bring in external javascript file.

E.g it works for when I use control in default.aspx using
ScriptFilePath="Scripts/filename.js"
ok when i click on link to navigate it goes to for
example, morepages/special.aspx page.

However,

When I use same control in webpage1.aspx with
ScriptFilePath="../Scripts/filename.js" then
I click on link in webpage1.aspx it produces following
path myproj/specialpages/morepages/special.aspx rather
than morepages/special.aspx.


any ideas


Thanks in advance

 
Reply With Quote
 
 
 
 
Stanley Glass
Guest
Posts: n/a
 
      01-05-2004
Try using the Tilde like so:
ScriptFilePath="~/Scripts/filename.js"

"New User" <> wrote in message
news:07b801c3b8fc$d09c9d20$...
> I have following structure for my project
>
>
> myproj
> Controls/control1
> morepages/special.aspx
> specialpages/webpage1.aspx
> scripts/filename.js
> default.aspx
>
>
>
> I have a control1 which has a public property name
> ScriptFilePath for bring in external javascript file.
>
> E.g it works for when I use control in default.aspx using
> ScriptFilePath="Scripts/filename.js"
> ok when i click on link to navigate it goes to for
> example, morepages/special.aspx page.
>
> However,
>
> When I use same control in webpage1.aspx with
> ScriptFilePath="../Scripts/filename.js" then
> I click on link in webpage1.aspx it produces following
> path myproj/specialpages/morepages/special.aspx rather
> than morepages/special.aspx.
>
>
> any ideas
>
>
> Thanks in advance
>



 
Reply With Quote
 
 
 
 
Imtiaz Hussain
Guest
Posts: n/a
 
      01-08-2004
You can also use ../ to go up one level and then traverse to the
appropriate directory where the javascript file resides.

Hope this helps.

Imtiaz Hussain.

This posting is provided "as is" with no warranties and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom webcontrol that references another webcontrol Fabricio ASP .Net Building Controls 0 09-21-2005 02:55 AM
Custom WebControl, custom property list Curt_C [MVP] ASP .Net Web Controls 0 09-01-2005 04:09 PM
Trapping an Exception ocurring in a Webcontrol at the Page or parent WebControl level. ASP .Net 2 01-31-2005 06:34 PM
WebControl inside of WebControl and attaching events Kasabaarde Sumta ASP .Net Building Controls 0 12-13-2004 09:51 PM
Can a webcontrol (webcontrol.dll) have a configuration file? Luis Ramírez. ASP .Net Building Controls 2 07-06-2004 04:35 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57