| Home | Forums | Reviews | Guides | Newsgroups | Register | Search |
![]() |
| Thread Tools |
| AAaron123 |
|
|
|
| |
|
AAaron123
Guest
Posts: n/a
|
I typed JavaScript in the site map below when I should have written
JavaScripts. I revised it. JavaScripts is at the root level. Your suggestion did not work probably because of my typo. So it works when the page's .aspx is at root but not when the page is in a subfolder. When a master is merged with a contents page I think all the file descriptions are adjusted. 1)Right? However, I'd guess that the quoted string containing openWindow would not be adjusted. <a href="JavaScript 2)Right? Maybe it doesn't need to be "adjusted" because it's in some global namespace? 3)Comment? Thanks "Patrice" <http://www.chez.com/scribe/> wrote in message news:326BA36B-EC34-4D73-B6FC-... > src="JavaScripts/OpenWindows.js" > > So the script must in a folder that is called JavaScripts and that is in > the same folder than the current ASPX page. See site map below. JavaScripts is in the root folder. The anchor calling openWindows is in the master. It work OK if the contents page is at root level but not with a contents page that is in a subfolder. I hope this makes more sense to you than it does to me. Any suggestions? > > You may want to try src="/JavaScripts/OpenWindows.js" so that it takes the > folder that is named JavaScripts and is at the root of the web site... > > -- > Patrice > > "AAaron123" <> a écrit dans le message de groupe > de discussion : ... >> In the master header I have >> <script type="text/javascript" src="JavaScripts\OpenWindow.js"></script> >> >> OpenWindow.js contains the function openWindow >> >> >> >> In the body of the master I have >> >> <a href="JavaScript >> >> >> >> When I click the anchor while the page showing is Default.aspx (which is >> at the root level as is .Master) the window opens OK. >> >> The folder JavaScripts is also at the root level and OpenWindow.js then >> one level below the root. >> >> If instead of showing Default.aspx which is at the root level I show the >> page Articles/Articles.aspx I find openWindow is undefined when I click >> the anchor. >> >> Do you see what is wrong? >> >> Thanks >> >> >> >> project >> >> Default.aspx >> >> Main.Master >> >> JavaScripts(folder) >> >> OpenWindow.js (contains function openWindow) >> >> Articles(folder) >> >> Articles.aspx >> >> >> >> >> >> >> >> > |
|
|
|
|
|||
|
|||
| AAaron123 |
|
|
|
| |
|
AAaron123
Guest
Posts: n/a
|
If I do this in the master
<script type="text/javascript" src="/JavaScripts/OpenWindow.js"></script> and this in the master <a href="JavaScript I always get openWindow is undefined. I don't think I'll have a problem adjusting the Images folder but I don't know why it doesn't find openWindow. Thanks a lot ps Without the leading slash it works ok from Default.aspx which is in the root with the master "Patrice" <http://www.chez.com/scribe/> wrote in message news > src="MyFolder" means the folder that is under the current page location. > src="/MyFolder" points to a folder to is under the root. > The master page doesn't play any role here. This is not a separate page. > Its content is just merged with the current page (much like a user > control). > > You can also check this using the IIS log. You should see that your app > ask for a js file that doesn't exists... > > So you'll have to adjust the js file name. You'll have also the same > problem for the Images folder.... > > The problem is that you are using relative paths so it depends where you > are and works only when you are at the root of your site. You should add a > leading / to use absolute paths... > > -- > Patrice > > "AAaron123" <> a écrit dans le message de groupe > de discussion : #... >> I typed JavaScript in the site map below when I should have written >> JavaScripts. I revised it. >> JavaScripts is at the root level. Your suggestion did not work probably >> because of my typo. >> >> So it works when the page's .aspx is at root but not when the page is in >> a subfolder. >> >> When a master is merged with a contents page I think all the file >> descriptions are adjusted. >> >> 1)Right? >> >> However, I'd guess that the quoted string containing openWindow would not >> be adjusted. >> <a href="JavaScript >> >> 2)Right? >> >> Maybe it doesn't need to be "adjusted" because it's in some global >> namespace? >> >> 3)Comment? >> >> >> Thanks >> >> >> "Patrice" <http://www.chez.com/scribe/> wrote in message >> news:326BA36B-EC34-4D73-B6FC-... >>> src="JavaScripts/OpenWindows.js" >>> >>> So the script must in a folder that is called JavaScripts and that is in >>> the same folder than the current ASPX page. >> >> >> See site map below. JavaScripts is in the root folder. >> >> The anchor calling openWindows is in the master. >> >> It work OK if the contents page is at root level but not with a contents >> page that is in a subfolder. >> >> I hope this makes more sense to you than it does to me. >> >> Any suggestions? >> >>> >>> You may want to try src="/JavaScripts/OpenWindows.js" so that it takes >>> the folder that is named JavaScripts and is at the root of the web >>> site... >>> >>> -- >>> Patrice >>> >>> "AAaron123" <> a écrit dans le message de groupe >>> de discussion : ... >>>> In the master header I have >>>> <script type="text/javascript" >>>> src="JavaScripts\OpenWindow.js"></script> >>>> >>>> OpenWindow.js contains the function openWindow >>>> >>>> >>>> >>>> In the body of the master I have >>>> >>>> <a href="JavaScript >>>> >>>> >>>> >>>> When I click the anchor while the page showing is Default.aspx (which >>>> is at the root level as is .Master) the window opens OK. >>>> >>>> The folder JavaScripts is also at the root level and OpenWindow.js then >>>> one level below the root. >>>> >>>> If instead of showing Default.aspx which is at the root level I show >>>> the page Articles/Articles.aspx I find openWindow is undefined when I >>>> click the anchor. >>>> >>>> Do you see what is wrong? >>>> >>>> Thanks >>>> >>>> >>>> >>>> project >>>> >>>> Default.aspx >>>> >>>> Main.Master >>>> >>>> JavaScripts(folder) >>>> >>>> OpenWindow.js (contains function openWindow) >>>> >>>> Articles(folder) >>>> >>>> Articles.aspx >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>> >> >> > |
|
|
|
|
|||
|
|||
| AAaron123 |
|
AAaron123
Guest
Posts: n/a
|
Since your last post I've been looking for my log file.
I find I am running IIS 5.1 and see that IIS 7 is around. Is 5.1 OK for XP Pro? I searched for all IIS files on my machine and no log showed up. Following some Internet information I right clicked my website in IIS and looked for the web tab but there isn't one. So I haven't yet found the log file. I did want to check as you suggested last time. "Patrice" <http://www.chez.com/scribe/> wrote in message news:401C6DA2-A2CF-4022-A9C6-... > Is your web application at the root of your web site ? In vs2008 under Solution Explorer there is the solution and under that 3 projects. Directly under one of them is the Default.aspx, web.config and Global.asax files. And the root is the last folder in that project title? This is the folder that show in IIS properties for this site. I'm not sure what defines the application but the above sounds like the answer is yes. Agree? > If your web application is the web site root you'll have to use > src="/MySubFolder/JavaScripts/OpenWindow.js". But (I hate saying "but") MySubFolder will be different on my machine and a host's machine - won't it? Thanks for sticking with this > > IMO your best best is to check the IIS log as you'll see what is requested > and if the file is found or not... > > -- > Patrice > > > "AAaron123" <> a écrit dans le message de groupe > de discussion : ... >> If I do this in the master >> <script type="text/javascript" src="/JavaScripts/OpenWindow.js"></script> >> >> and this in the master >> >> <a href="JavaScript >> >> I always get openWindow is undefined. >> >> >> >> I don't think I'll have a problem adjusting the Images folder >> >> but I don't know why it doesn't find openWindow. >> >> >> >> Thanks a lot >> >> ps >> Without the leading slash it works ok from Default.aspx which is in the >> root with the master >> >> >> >> "Patrice" <http://www.chez.com/scribe/> wrote in message >> news >>> src="MyFolder" means the folder that is under the current page location. >>> src="/MyFolder" points to a folder to is under the root. >>> The master page doesn't play any role here. This is not a separate page. >>> Its content is just merged with the current page (much like a user >>> control). >>> >>> You can also check this using the IIS log. You should see that your app >>> ask for a js file that doesn't exists... >>> >>> So you'll have to adjust the js file name. You'll have also the same >>> problem for the Images folder.... >>> >>> The problem is that you are using relative paths so it depends where you >>> are and works only when you are at the root of your site. You should add >>> a leading / to use absolute paths... >>> >>> -- >>> Patrice >>> >>> "AAaron123" <> a écrit dans le message de groupe >>> de discussion : #... >>>> I typed JavaScript in the site map below when I should have written >>>> JavaScripts. I revised it. >>>> JavaScripts is at the root level. Your suggestion did not work probably >>>> because of my typo. >>>> >>>> So it works when the page's .aspx is at root but not when the page is >>>> in a subfolder. >>>> >>>> When a master is merged with a contents page I think all the file >>>> descriptions are adjusted. >>>> >>>> 1)Right? >>>> >>>> However, I'd guess that the quoted string containing openWindow would >>>> not be adjusted. >>>> <a href="JavaScript >>>> >>>> 2)Right? >>>> >>>> Maybe it doesn't need to be "adjusted" because it's in some global >>>> namespace? >>>> >>>> 3)Comment? >>>> >>>> >>>> Thanks >>>> >>>> >>>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>>> news:326BA36B-EC34-4D73-B6FC-... >>>>> src="JavaScripts/OpenWindows.js" >>>>> >>>>> So the script must in a folder that is called JavaScripts and that is >>>>> in the same folder than the current ASPX page. >>>> >>>> >>>> See site map below. JavaScripts is in the root folder. >>>> >>>> The anchor calling openWindows is in the master. >>>> >>>> It work OK if the contents page is at root level but not with a >>>> contents page that is in a subfolder. >>>> >>>> I hope this makes more sense to you than it does to me. >>>> >>>> Any suggestions? >>>> >>>>> >>>>> You may want to try src="/JavaScripts/OpenWindows.js" so that it takes >>>>> the folder that is named JavaScripts and is at the root of the web >>>>> site... >>>>> >>>>> -- >>>>> Patrice >>>>> >>>>> "AAaron123" <> a écrit dans le message de >>>>> groupe de discussion : ... >>>>>> In the master header I have >>>>>> <script type="text/javascript" >>>>>> src="JavaScripts\OpenWindow.js"></script> >>>>>> >>>>>> OpenWindow.js contains the function openWindow >>>>>> >>>>>> >>>>>> >>>>>> In the body of the master I have >>>>>> >>>>>> <a href="JavaScript >>>>>> >>>>>> >>>>>> >>>>>> When I click the anchor while the page showing is Default.aspx (which >>>>>> is at the root level as is .Master) the window opens OK. >>>>>> >>>>>> The folder JavaScripts is also at the root level and OpenWindow.js >>>>>> then one level below the root. >>>>>> >>>>>> If instead of showing Default.aspx which is at the root level I show >>>>>> the page Articles/Articles.aspx I find openWindow is undefined when I >>>>>> click the anchor. >>>>>> >>>>>> Do you see what is wrong? >>>>>> >>>>>> Thanks >>>>>> >>>>>> >>>>>> >>>>>> project >>>>>> >>>>>> Default.aspx >>>>>> >>>>>> Main.Master >>>>>> >>>>>> JavaScripts(folder) >>>>>> >>>>>> OpenWindow.js (contains function openWindow) >>>>>> >>>>>> Articles(folder) >>>>>> >>>>>> Articles.aspx >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>>> >>> >> >> > |
|
|
|
|
|||
|
|||
| AAaron123 |
|
AAaron123
Guest
Posts: n/a
|
Your suggestion to use
"/MySubFolder/JavaScripts..." and "/MySubFolder/Images..." fixed it. But the Hosting site gave me a different folder name to use. Can't I capture that folder name and store it in a session variable? Would that be a good way to go? Thanks for all the help "Patrice" <http://www.chez.com/scribe/> wrote in message news:401C6DA2-A2CF-4022-A9C6-... > Is your web application at the root of your web site ? If your web > application is the web site root you'll have to use > src="/MySubFolder/JavaScripts/OpenWindow.js". > > IMO your best best is to check the IIS log as you'll see what is requested > and if the file is found or not... > > -- > Patrice > > > "AAaron123" <> a écrit dans le message de groupe > de discussion : ... >> If I do this in the master >> <script type="text/javascript" src="/JavaScripts/OpenWindow.js"></script> >> >> and this in the master >> >> <a href="JavaScript >> >> I always get openWindow is undefined. >> >> >> >> I don't think I'll have a problem adjusting the Images folder >> >> but I don't know why it doesn't find openWindow. >> >> >> >> Thanks a lot >> >> ps >> Without the leading slash it works ok from Default.aspx which is in the >> root with the master >> >> >> >> "Patrice" <http://www.chez.com/scribe/> wrote in message >> news >>> src="MyFolder" means the folder that is under the current page location. >>> src="/MyFolder" points to a folder to is under the root. >>> The master page doesn't play any role here. This is not a separate page. >>> Its content is just merged with the current page (much like a user >>> control). >>> >>> You can also check this using the IIS log. You should see that your app >>> ask for a js file that doesn't exists... >>> >>> So you'll have to adjust the js file name. You'll have also the same >>> problem for the Images folder.... >>> >>> The problem is that you are using relative paths so it depends where you >>> are and works only when you are at the root of your site. You should add >>> a leading / to use absolute paths... >>> >>> -- >>> Patrice >>> >>> "AAaron123" <> a écrit dans le message de groupe >>> de discussion : #... >>>> I typed JavaScript in the site map below when I should have written >>>> JavaScripts. I revised it. >>>> JavaScripts is at the root level. Your suggestion did not work probably >>>> because of my typo. >>>> >>>> So it works when the page's .aspx is at root but not when the page is >>>> in a subfolder. >>>> >>>> When a master is merged with a contents page I think all the file >>>> descriptions are adjusted. >>>> >>>> 1)Right? >>>> >>>> However, I'd guess that the quoted string containing openWindow would >>>> not be adjusted. >>>> <a href="JavaScript >>>> >>>> 2)Right? >>>> >>>> Maybe it doesn't need to be "adjusted" because it's in some global >>>> namespace? >>>> >>>> 3)Comment? >>>> >>>> >>>> Thanks >>>> >>>> >>>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>>> news:326BA36B-EC34-4D73-B6FC-... >>>>> src="JavaScripts/OpenWindows.js" >>>>> >>>>> So the script must in a folder that is called JavaScripts and that is >>>>> in the same folder than the current ASPX page. >>>> >>>> >>>> See site map below. JavaScripts is in the root folder. >>>> >>>> The anchor calling openWindows is in the master. >>>> >>>> It work OK if the contents page is at root level but not with a >>>> contents page that is in a subfolder. >>>> >>>> I hope this makes more sense to you than it does to me. >>>> >>>> Any suggestions? >>>> >>>>> >>>>> You may want to try src="/JavaScripts/OpenWindows.js" so that it takes >>>>> the folder that is named JavaScripts and is at the root of the web >>>>> site... >>>>> >>>>> -- >>>>> Patrice >>>>> >>>>> "AAaron123" <> a écrit dans le message de >>>>> groupe de discussion : ... >>>>>> In the master header I have >>>>>> <script type="text/javascript" >>>>>> src="JavaScripts\OpenWindow.js"></script> >>>>>> >>>>>> OpenWindow.js contains the function openWindow >>>>>> >>>>>> >>>>>> >>>>>> In the body of the master I have >>>>>> >>>>>> <a href="JavaScript >>>>>> >>>>>> >>>>>> >>>>>> When I click the anchor while the page showing is Default.aspx (which >>>>>> is at the root level as is .Master) the window opens OK. >>>>>> >>>>>> The folder JavaScripts is also at the root level and OpenWindow.js >>>>>> then one level below the root. >>>>>> >>>>>> If instead of showing Default.aspx which is at the root level I show >>>>>> the page Articles/Articles.aspx I find openWindow is undefined when I >>>>>> click the anchor. >>>>>> >>>>>> Do you see what is wrong? >>>>>> >>>>>> Thanks >>>>>> >>>>>> >>>>>> >>>>>> project >>>>>> >>>>>> Default.aspx >>>>>> >>>>>> Main.Master >>>>>> >>>>>> JavaScripts(folder) >>>>>> >>>>>> OpenWindow.js (contains function openWindow) >>>>>> >>>>>> Articles(folder) >>>>>> >>>>>> Articles.aspx >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>>> >>> >> >> > |
|
|
|
|
|||
|
|||
| AAaron123 |
|
miher
Guest
Posts: n/a
|
Hi,
Try to add the reference in code by putting this line into Your master pages Load instead of the <script> block in Your markup: Page.ClientScript.RegisterClientScriptInclude(GetT ype(), "scripts", ResolveClientUrl("~/JavaScripts/OpenWindow.js")); Hope You find this useful. -Zsolt "AAaron123" <> wrote in message news:eu#rH#... > Your suggestion to use > "/MySubFolder/JavaScripts..." and > "/MySubFolder/Images..." > fixed it. > > But the Hosting site gave me a different folder name to use. > > Can't I capture that folder name and store it in a session variable? > > Would that be a good way to go? > > Thanks for all the help > > > "Patrice" <http://www.chez.com/scribe/> wrote in message > news:401C6DA2-A2CF-4022-A9C6-... >> Is your web application at the root of your web site ? If your web >> application is the web site root you'll have to use >> src="/MySubFolder/JavaScripts/OpenWindow.js". >> >> IMO your best best is to check the IIS log as you'll see what is >> requested and if the file is found or not... >> >> -- >> Patrice >> >> >> "AAaron123" <> a écrit dans le message de groupe >> de discussion : ... >>> If I do this in the master >>> <script type="text/javascript" >>> src="/JavaScripts/OpenWindow.js"></script> >>> >>> and this in the master >>> >>> <a href="JavaScript >>> >>> I always get openWindow is undefined. >>> >>> >>> >>> I don't think I'll have a problem adjusting the Images folder >>> >>> but I don't know why it doesn't find openWindow. >>> >>> >>> >>> Thanks a lot >>> >>> ps >>> Without the leading slash it works ok from Default.aspx which is in the >>> root with the master >>> >>> >>> >>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>> news >>>> src="MyFolder" means the folder that is under the current page >>>> location. src="/MyFolder" points to a folder to is under the root. >>>> The master page doesn't play any role here. This is not a separate >>>> page. Its content is just merged with the current page (much like a >>>> user control). >>>> >>>> You can also check this using the IIS log. You should see that your app >>>> ask for a js file that doesn't exists... >>>> >>>> So you'll have to adjust the js file name. You'll have also the same >>>> problem for the Images folder.... >>>> >>>> The problem is that you are using relative paths so it depends where >>>> you are and works only when you are at the root of your site. You >>>> should add a leading / to use absolute paths... >>>> >>>> -- >>>> Patrice >>>> >>>> "AAaron123" <> a écrit dans le message de >>>> groupe de discussion : #... >>>>> I typed JavaScript in the site map below when I should have written >>>>> JavaScripts. I revised it. >>>>> JavaScripts is at the root level. Your suggestion did not work >>>>> probably because of my typo. >>>>> >>>>> So it works when the page's .aspx is at root but not when the page is >>>>> in a subfolder. >>>>> >>>>> When a master is merged with a contents page I think all the file >>>>> descriptions are adjusted. >>>>> >>>>> 1)Right? >>>>> >>>>> However, I'd guess that the quoted string containing openWindow would >>>>> not be adjusted. >>>>> <a href="JavaScript >>>>> >>>>> 2)Right? >>>>> >>>>> Maybe it doesn't need to be "adjusted" because it's in some global >>>>> namespace? >>>>> >>>>> 3)Comment? >>>>> >>>>> >>>>> Thanks >>>>> >>>>> >>>>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>>>> news:326BA36B-EC34-4D73-B6FC-... >>>>>> src="JavaScripts/OpenWindows.js" >>>>>> >>>>>> So the script must in a folder that is called JavaScripts and that is >>>>>> in the same folder than the current ASPX page. >>>>> >>>>> >>>>> See site map below. JavaScripts is in the root folder. >>>>> >>>>> The anchor calling openWindows is in the master. >>>>> >>>>> It work OK if the contents page is at root level but not with a >>>>> contents page that is in a subfolder. >>>>> >>>>> I hope this makes more sense to you than it does to me. >>>>> >>>>> Any suggestions? >>>>> >>>>>> >>>>>> You may want to try src="/JavaScripts/OpenWindows.js" so that it >>>>>> takes the folder that is named JavaScripts and is at the root of the >>>>>> web site... >>>>>> >>>>>> -- >>>>>> Patrice >>>>>> >>>>>> "AAaron123" <> a écrit dans le message de >>>>>> groupe de discussion : ... >>>>>>> In the master header I have >>>>>>> <script type="text/javascript" >>>>>>> src="JavaScripts\OpenWindow.js"></script> >>>>>>> >>>>>>> OpenWindow.js contains the function openWindow >>>>>>> >>>>>>> >>>>>>> >>>>>>> In the body of the master I have >>>>>>> >>>>>>> <a href="JavaScript >>>>>>> >>>>>>> >>>>>>> >>>>>>> When I click the anchor while the page showing is Default.aspx >>>>>>> (which is at the root level as is .Master) the window opens OK. >>>>>>> >>>>>>> The folder JavaScripts is also at the root level and OpenWindow.js >>>>>>> then one level below the root. >>>>>>> >>>>>>> If instead of showing Default.aspx which is at the root level I show >>>>>>> the page Articles/Articles.aspx I find openWindow is undefined when >>>>>>> I click the anchor. >>>>>>> >>>>>>> Do you see what is wrong? >>>>>>> >>>>>>> Thanks >>>>>>> >>>>>>> >>>>>>> >>>>>>> project >>>>>>> >>>>>>> Default.aspx >>>>>>> >>>>>>> Main.Master >>>>>>> >>>>>>> JavaScripts(folder) >>>>>>> >>>>>>> OpenWindow.js (contains function openWindow) >>>>>>> >>>>>>> Articles(folder) >>>>>>> >>>>>>> Articles.aspx >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>>> >>>> >>> >>> >> > > |
|
|
|
|
|||
|
|||
| miher |
|
AAaron123
Guest
Posts: n/a
|
Trying to make /MySubFolder/ work at the hosting and debugging sessions I
tried to use Request.ApplicationPath. What can I put in the head? I tried <script type="text/javascript"> function rootDir() { return '<%=ResolveUrl(Request.ApplicationPath)%>'; //return '<%=Request.ApplicationPath%>'; } </script > <script type="text/javascript" src= rootDir() + "/JavaScripts/OpenWindow.js"></script> But that didn't work. So I move to Global.asax setting a session variable to Request.ApplicationPathand tried <script type="text/javascript" src= Session("RootDir") + "/JavaScripts/OpenWindow.js"></script> But that didn't work either. Does the head have to have only nonexecutable markup? Thanks I'm not sure if I mentioned it in a previous post but your suggestion did work for me on my debugging station. Now I want to make it general so that it work at the hosting site as well. "Patrice" <http://www.chez.com/scribe/> wrote in message news:401C6DA2-A2CF-4022-A9C6-... > Is your web application at the root of your web site ? If your web > application is the web site root you'll have to use > src="/MySubFolder/JavaScripts/OpenWindow.js". > > IMO your best best is to check the IIS log as you'll see what is requested > and if the file is found or not... > > -- > Patrice > > > "AAaron123" <> a écrit dans le message de groupe > de discussion : ... >> If I do this in the master >> <script type="text/javascript" src="/JavaScripts/OpenWindow.js"></script> >> >> and this in the master >> >> <a href="JavaScript >> >> I always get openWindow is undefined. >> >> >> >> I don't think I'll have a problem adjusting the Images folder >> >> but I don't know why it doesn't find openWindow. >> >> >> >> Thanks a lot >> >> ps >> Without the leading slash it works ok from Default.aspx which is in the >> root with the master >> >> >> >> "Patrice" <http://www.chez.com/scribe/> wrote in message >> news >>> src="MyFolder" means the folder that is under the current page location. >>> src="/MyFolder" points to a folder to is under the root. >>> The master page doesn't play any role here. This is not a separate page. >>> Its content is just merged with the current page (much like a user >>> control). >>> >>> You can also check this using the IIS log. You should see that your app >>> ask for a js file that doesn't exists... >>> >>> So you'll have to adjust the js file name. You'll have also the same >>> problem for the Images folder.... >>> >>> The problem is that you are using relative paths so it depends where you >>> are and works only when you are at the root of your site. You should add >>> a leading / to use absolute paths... >>> >>> -- >>> Patrice >>> >>> "AAaron123" <> a écrit dans le message de groupe >>> de discussion : #... >>>> I typed JavaScript in the site map below when I should have written >>>> JavaScripts. I revised it. >>>> JavaScripts is at the root level. Your suggestion did not work probably >>>> because of my typo. >>>> >>>> So it works when the page's .aspx is at root but not when the page is >>>> in a subfolder. >>>> >>>> When a master is merged with a contents page I think all the file >>>> descriptions are adjusted. >>>> >>>> 1)Right? >>>> >>>> However, I'd guess that the quoted string containing openWindow would >>>> not be adjusted. >>>> <a href="JavaScript >>>> >>>> 2)Right? >>>> >>>> Maybe it doesn't need to be "adjusted" because it's in some global >>>> namespace? >>>> >>>> 3)Comment? >>>> >>>> >>>> Thanks >>>> >>>> >>>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>>> news:326BA36B-EC34-4D73-B6FC-... >>>>> src="JavaScripts/OpenWindows.js" >>>>> >>>>> So the script must in a folder that is called JavaScripts and that is >>>>> in the same folder than the current ASPX page. >>>> >>>> >>>> See site map below. JavaScripts is in the root folder. >>>> >>>> The anchor calling openWindows is in the master. >>>> >>>> It work OK if the contents page is at root level but not with a >>>> contents page that is in a subfolder. >>>> >>>> I hope this makes more sense to you than it does to me. >>>> >>>> Any suggestions? >>>> >>>>> >>>>> You may want to try src="/JavaScripts/OpenWindows.js" so that it takes >>>>> the folder that is named JavaScripts and is at the root of the web >>>>> site... >>>>> >>>>> -- >>>>> Patrice >>>>> >>>>> "AAaron123" <> a écrit dans le message de >>>>> groupe de discussion : ... >>>>>> In the master header I have >>>>>> <script type="text/javascript" >>>>>> src="JavaScripts\OpenWindow.js"></script> >>>>>> >>>>>> OpenWindow.js contains the function openWindow >>>>>> >>>>>> >>>>>> >>>>>> In the body of the master I have >>>>>> >>>>>> <a href="JavaScript >>>>>> >>>>>> >>>>>> >>>>>> When I click the anchor while the page showing is Default.aspx (which >>>>>> is at the root level as is .Master) the window opens OK. >>>>>> >>>>>> The folder JavaScripts is also at the root level and OpenWindow.js >>>>>> then one level below the root. >>>>>> >>>>>> If instead of showing Default.aspx which is at the root level I show >>>>>> the page Articles/Articles.aspx I find openWindow is undefined when I >>>>>> click the anchor. >>>>>> >>>>>> Do you see what is wrong? >>>>>> >>>>>> Thanks >>>>>> >>>>>> >>>>>> >>>>>> project >>>>>> >>>>>> Default.aspx >>>>>> >>>>>> Main.Master >>>>>> >>>>>> JavaScripts(folder) >>>>>> >>>>>> OpenWindow.js (contains function openWindow) >>>>>> >>>>>> Articles(folder) >>>>>> >>>>>> Articles.aspx >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>> >>>> >>> >> >> > |
|
|
|
|
|||
|
|||
| AAaron123 |
|
AAaron123
Guest
Posts: n/a
|
Boy, that looks the simplest of all. First I want to get my present approach
working then I'll try this. Thanks a lot "miher" <> wrote in message news:... > Hi, > > Try to add the reference in code by putting this line into Your master > pages Load instead of the <script> block in Your markup: > > Page.ClientScript.RegisterClientScriptInclude(GetT ype(), "scripts", > ResolveClientUrl("~/JavaScripts/OpenWindow.js")); > > Hope You find this useful. > -Zsolt > > > "AAaron123" <> wrote in message > news:eu#rH#... >> Your suggestion to use >> "/MySubFolder/JavaScripts..." and >> "/MySubFolder/Images..." >> fixed it. >> >> But the Hosting site gave me a different folder name to use. >> >> Can't I capture that folder name and store it in a session variable? >> >> Would that be a good way to go? >> >> Thanks for all the help >> >> >> "Patrice" <http://www.chez.com/scribe/> wrote in message >> news:401C6DA2-A2CF-4022-A9C6-... >>> Is your web application at the root of your web site ? If your web >>> application is the web site root you'll have to use >>> src="/MySubFolder/JavaScripts/OpenWindow.js". >>> >>> IMO your best best is to check the IIS log as you'll see what is >>> requested and if the file is found or not... >>> >>> -- >>> Patrice >>> >>> >>> "AAaron123" <> a écrit dans le message de groupe >>> de discussion : ... >>>> If I do this in the master >>>> <script type="text/javascript" >>>> src="/JavaScripts/OpenWindow.js"></script> >>>> >>>> and this in the master >>>> >>>> <a href="JavaScript >>>> >>>> I always get openWindow is undefined. >>>> >>>> >>>> >>>> I don't think I'll have a problem adjusting the Images folder >>>> >>>> but I don't know why it doesn't find openWindow. >>>> >>>> >>>> >>>> Thanks a lot >>>> >>>> ps >>>> Without the leading slash it works ok from Default.aspx which is in the >>>> root with the master >>>> >>>> >>>> >>>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>>> news >>>>> src="MyFolder" means the folder that is under the current page >>>>> location. src="/MyFolder" points to a folder to is under the root. >>>>> The master page doesn't play any role here. This is not a separate >>>>> page. Its content is just merged with the current page (much like a >>>>> user control). >>>>> >>>>> You can also check this using the IIS log. You should see that your >>>>> app ask for a js file that doesn't exists... >>>>> >>>>> So you'll have to adjust the js file name. You'll have also the same >>>>> problem for the Images folder.... >>>>> >>>>> The problem is that you are using relative paths so it depends where >>>>> you are and works only when you are at the root of your site. You >>>>> should add a leading / to use absolute paths... >>>>> >>>>> -- >>>>> Patrice >>>>> >>>>> "AAaron123" <> a écrit dans le message de >>>>> groupe de discussion : #... >>>>>> I typed JavaScript in the site map below when I should have written >>>>>> JavaScripts. I revised it. >>>>>> JavaScripts is at the root level. Your suggestion did not work >>>>>> probably because of my typo. >>>>>> >>>>>> So it works when the page's .aspx is at root but not when the page is >>>>>> in a subfolder. >>>>>> >>>>>> When a master is merged with a contents page I think all the file >>>>>> descriptions are adjusted. >>>>>> >>>>>> 1)Right? >>>>>> >>>>>> However, I'd guess that the quoted string containing openWindow would >>>>>> not be adjusted. >>>>>> <a href="JavaScript >>>>>> >>>>>> 2)Right? >>>>>> >>>>>> Maybe it doesn't need to be "adjusted" because it's in some global >>>>>> namespace? >>>>>> >>>>>> 3)Comment? >>>>>> >>>>>> >>>>>> Thanks >>>>>> >>>>>> >>>>>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>>>>> news:326BA36B-EC34-4D73-B6FC-... >>>>>>> src="JavaScripts/OpenWindows.js" >>>>>>> >>>>>>> So the script must in a folder that is called JavaScripts and that >>>>>>> is in the same folder than the current ASPX page. >>>>>> >>>>>> >>>>>> See site map below. JavaScripts is in the root folder. >>>>>> >>>>>> The anchor calling openWindows is in the master. >>>>>> >>>>>> It work OK if the contents page is at root level but not with a >>>>>> contents page that is in a subfolder. >>>>>> >>>>>> I hope this makes more sense to you than it does to me. >>>>>> >>>>>> Any suggestions? >>>>>> >>>>>>> >>>>>>> You may want to try src="/JavaScripts/OpenWindows.js" so that it >>>>>>> takes the folder that is named JavaScripts and is at the root of the >>>>>>> web site... >>>>>>> >>>>>>> -- >>>>>>> Patrice >>>>>>> >>>>>>> "AAaron123" <> a écrit dans le message de >>>>>>> groupe de discussion : ... >>>>>>>> In the master header I have >>>>>>>> <script type="text/javascript" >>>>>>>> src="JavaScripts\OpenWindow.js"></script> >>>>>>>> >>>>>>>> OpenWindow.js contains the function openWindow >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> In the body of the master I have >>>>>>>> >>>>>>>> <a href="JavaScript >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> When I click the anchor while the page showing is Default.aspx >>>>>>>> (which is at the root level as is .Master) the window opens OK. >>>>>>>> >>>>>>>> The folder JavaScripts is also at the root level and OpenWindow.js >>>>>>>> then one level below the root. >>>>>>>> >>>>>>>> If instead of showing Default.aspx which is at the root level I >>>>>>>> show the page Articles/Articles.aspx I find openWindow is undefined >>>>>>>> when I click the anchor. >>>>>>>> >>>>>>>> Do you see what is wrong? >>>>>>>> >>>>>>>> Thanks >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> project >>>>>>>> >>>>>>>> Default.aspx >>>>>>>> >>>>>>>> Main.Master >>>>>>>> >>>>>>>> JavaScripts(folder) >>>>>>>> >>>>>>>> OpenWindow.js (contains function openWindow) >>>>>>>> >>>>>>>> Articles(folder) >>>>>>>> >>>>>>>> Articles.aspx >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>> >>>> >>> >> >> |
|
|
|
|
|||
|
|||
| AAaron123 |
|
AAaron123
Guest
Posts: n/a
|
I seem to be stuck in coming up with a way to register the script in the
head so that it works in my debug machine and in the hosting service so I tried your approach and it appears to work well. I only tried it on my machine but it appears that it should work on the host. I think GetType() in your code is not sufficient. I used Page.GetType() because of something in the msdn docs. Thanks "AAaron123" <> wrote in message news:... > Boy, that looks the simplest of all. First I want to get my present > approach working then I'll try this. > > Thanks a lot > > "miher" <> wrote in message > news:... >> Hi, >> >> Try to add the reference in code by putting this line into Your master >> pages Load instead of the <script> block in Your markup: >> >> Page.ClientScript.RegisterClientScriptInclude(GetT ype(), "scripts", >> ResolveClientUrl("~/JavaScripts/OpenWindow.js")); >> >> Hope You find this useful. >> -Zsolt >> >> >> "AAaron123" <> wrote in message >> news:eu#rH#... >>> Your suggestion to use >>> "/MySubFolder/JavaScripts..." and >>> "/MySubFolder/Images..." >>> fixed it. >>> >>> But the Hosting site gave me a different folder name to use. >>> >>> Can't I capture that folder name and store it in a session variable? >>> >>> Would that be a good way to go? >>> >>> Thanks for all the help >>> >>> >>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>> news:401C6DA2-A2CF-4022-A9C6-... >>>> Is your web application at the root of your web site ? If your web >>>> application is the web site root you'll have to use >>>> src="/MySubFolder/JavaScripts/OpenWindow.js". >>>> >>>> IMO your best best is to check the IIS log as you'll see what is >>>> requested and if the file is found or not... >>>> >>>> -- >>>> Patrice >>>> >>>> >>>> "AAaron123" <> a écrit dans le message de >>>> groupe de discussion : ... >>>>> If I do this in the master >>>>> <script type="text/javascript" >>>>> src="/JavaScripts/OpenWindow.js"></script> >>>>> >>>>> and this in the master >>>>> >>>>> <a href="JavaScript >>>>> >>>>> I always get openWindow is undefined. >>>>> >>>>> >>>>> >>>>> I don't think I'll have a problem adjusting the Images folder >>>>> >>>>> but I don't know why it doesn't find openWindow. >>>>> >>>>> >>>>> >>>>> Thanks a lot >>>>> >>>>> ps >>>>> Without the leading slash it works ok from Default.aspx which is in >>>>> the root with the master >>>>> >>>>> >>>>> >>>>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>>>> news >>>>>> src="MyFolder" means the folder that is under the current page >>>>>> location. src="/MyFolder" points to a folder to is under the root. >>>>>> The master page doesn't play any role here. This is not a separate >>>>>> page. Its content is just merged with the current page (much like a >>>>>> user control). >>>>>> >>>>>> You can also check this using the IIS log. You should see that your >>>>>> app ask for a js file that doesn't exists... >>>>>> >>>>>> So you'll have to adjust the js file name. You'll have also the same >>>>>> problem for the Images folder.... >>>>>> >>>>>> The problem is that you are using relative paths so it depends where >>>>>> you are and works only when you are at the root of your site. You >>>>>> should add a leading / to use absolute paths... >>>>>> >>>>>> -- >>>>>> Patrice >>>>>> >>>>>> "AAaron123" <> a écrit dans le message de >>>>>> groupe de discussion : #... >>>>>>> I typed JavaScript in the site map below when I should have written >>>>>>> JavaScripts. I revised it. >>>>>>> JavaScripts is at the root level. Your suggestion did not work >>>>>>> probably because of my typo. >>>>>>> >>>>>>> So it works when the page's .aspx is at root but not when the page >>>>>>> is in a subfolder. >>>>>>> >>>>>>> When a master is merged with a contents page I think all the file >>>>>>> descriptions are adjusted. >>>>>>> >>>>>>> 1)Right? >>>>>>> >>>>>>> However, I'd guess that the quoted string containing openWindow >>>>>>> would not be adjusted. >>>>>>> <a href="JavaScript >>>>>>> >>>>>>> 2)Right? >>>>>>> >>>>>>> Maybe it doesn't need to be "adjusted" because it's in some global >>>>>>> namespace? >>>>>>> >>>>>>> 3)Comment? >>>>>>> >>>>>>> >>>>>>> Thanks >>>>>>> >>>>>>> >>>>>>> "Patrice" <http://www.chez.com/scribe/> wrote in message >>>>>>> news:326BA36B-EC34-4D73-B6FC-... >>>>>>>> src="JavaScripts/OpenWindows.js" >>>>>>>> >>>>>>>> So the script must in a folder that is called JavaScripts and that >>>>>>>> is in the same folder than the current ASPX page. >>>>>>> >>>>>>> >>>>>>> See site map below. JavaScripts is in the root folder. >>>>>>> >>>>>>> The anchor calling openWindows is in the master. >>>>>>> >>>>>>> It work OK if the contents page is at root level but not with a >>>>>>> contents page that is in a subfolder. >>>>>>> >>>>>>> I hope this makes more sense to you than it does to me. >>>>>>> >>>>>>> Any suggestions? >>>>>>> >>>>>>>> >>>>>>>> You may want to try src="/JavaScripts/OpenWindows.js" so that it >>>>>>>> takes the folder that is named JavaScripts and is at the root of >>>>>>>> the web site... >>>>>>>> >>>>>>>> -- >>>>>>>> Patrice >>>>>>>> >>>>>>>> "AAaron123" <> a écrit dans le message de >>>>>>>> groupe de discussion : ... >>>>>>>>> In the master header I have >>>>>>>>> <script type="text/javascript" >>>>>>>>> src="JavaScripts\OpenWindow.js"></script> >>>>>>>>> >>>>>>>>> OpenWindow.js contains the function openWindow >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> In the body of the master I have >>>>>>>>> >>>>>>>>> <a href="JavaScript >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> When I click the anchor while the page showing is Default.aspx >>>>>>>>> (which is at the root level as is .Master) the window opens OK. >>>>>>>>> >>>>>>>>> The folder JavaScripts is also at the root level and OpenWindow.js >>>>>>>>> then one level below the root. >>>>>>>>> >>>>>>>>> If instead of showing Default.aspx which is at the root level I >>>>>>>>> show the page Articles/Articles.aspx I find openWindow is >>>>>>>>> undefined when I click the anchor. >>>>>>>>> >>>>>>>>> Do you see what is wrong? >>>>>>>>> >>>>>>>>> Thanks >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> project >>>>>>>>> >>>>>>>>> Default.aspx >>>>>>>>> >>>>>>>>> Main.Master >>>>>>>>> >>>>>>>>> JavaScripts(folder) >>>>>>>>> >>>>>>>>> OpenWindow.js (contains function openWindow) >>>>>>>>> >>>>>>>>> Articles(folder) >>>>>>>>> >>>>>>>>> Articles.aspx >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>>> >>>> >>> >>> > > |
|
|
|
|
|||
|
|||
| AAaron123 |
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| and becomes or and or becomes and | Stef Mientki | Python | 9 | 05-28-2011 02:04 PM |
| createImage sometime returns null and sometime returns non-null. | vizlab | Java | 3 | 10-17-2007 11:21 AM |
| List Variable becomes undefined inexplicably | mattbreedlove@yahoo.com | Perl Misc | 15 | 09-23-2007 10:59 AM |
| Reversing Bit Order.. i.e. MSB becomes bit 0, LSB becomes bit 15 | benn686@hotmail.com | C++ | 9 | 08-22-2007 12:13 AM |
| RAM - 2gb becomes 4gb becomes 2gb | b | Computer Support | 10 | 04-27-2006 11:58 PM |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc..
SEO by vBSEO ©2010, Crawlability, Inc. |




