473,386 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

external js file with masterpage

Hi,

I use a masterpage for all my project.
For some pages I have some external javascript file that I would like to
include.
How can I do this action from the content pages ?

Stan
Aug 14 '06 #1
2 1654
From individual pages, this is simple. Just link to the JavaScript. From the
master page, it is more difficult, as the JavaScript linking does not
respect the ResolveClientUrl() for some reason. Either that, or I have not
found the magic.

Put the links in teh pages you need, or create a page object that has the
link and inherit from it.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************************************************
Think Outside the Box!
*************************************************
"Stan SR" <st**@pasdepam.netsunset.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Hi,

I use a masterpage for all my project.
For some pages I have some external javascript file that I would like to
include.
How can I do this action from the content pages ?

Stan

Aug 15 '06 #2
Stan SR napsal(a):
Hi,

I use a masterpage for all my project.
For some pages I have some external javascript file that I would like to
include.
How can I do this action from the content pages ?

Stan

Try following code(in masterpage's OnLoad)

protected string m_sScript = "MasterPageRoot/MasterPageScript.js";

.....
string sPrefix = string.Empty;
if (Request.AppRelativeCurrentExecutionFilePath.Index Of("inner-folder")
-1)
sPrefix = "../";

this.DataBind();

.... and in masterpage
<script src="<%#m_sScript%>" type="text/javascript">

Pavel
Aug 15 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex Maghen | last post by:
Hi. I'm a little confused about the code that resides in the code-behind of a MasterPage and the code that resides in the code-behind of the actual pages that USE that MasterPage. I'm noticing,...
5
by: Islamegy® | last post by:
In my project i have two master page which i change dynamic in runtime.. The first one with 1 ContentPanel "onepanel.master", the second with 2 contentPanel"twopanel.master".. but when i switch...
2
by: .seb | last post by:
Hi, easy question...! I have an app with my masterpage and all, but now I what to show and external page in that "frame", where controlplaceholder is. Let's say I want to show the google page in...
4
by: cevans | last post by:
Is there a way to load a MasterPage programmatically? Not switch a page's masterpage but to create a MasterPage object that holds a given masterpage. So I know I can do: MasterPage master =...
2
by: Sebho | last post by:
Hi, i have an asp page (page1.aspx) that inherits from a masterpage (MasterPage.master) so i try to define a stylesheet (mystyle.css) page to Page1.aspx and i have to put a <linktag between...
1
by: Larry Rebich | last post by:
I'm using some Java Script I found that supports a 'back' button on my ASP.Net page. The Asp.Net page uses a Master page. I thought I'd put the Java Script in a Java Script file . The thought was...
0
by: mohammadkashif | last post by:
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. ...
6
by: Sunfire | last post by:
Is there a way you can test what page is loaded from inside a master page? What I need to do is test to see what page is loaded inside the master page and then gray out the root item linked to that...
0
by: KingKong07 | last post by:
Hi! I have a problem with publishing my solution. I use “Use fixed naming and single page assemblies” to publish. So I just can update one and one file, this works fine, but today I had to update...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.