473,597 Members | 2,342 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net page: Javascript not loading

I posted a similar question earlier and got lots of good feedback, but
now I have more information:

Problem: I have javascript in a user control that is not "loading"
properly. When I try to call the script from my page, I get "object
not found".

Temporary Workaround: This only happens when I have "debug=true " in my
web.config. If I remove debug=true then then script works fine.

More info:
Here's the hierarchy of my entire page:

Master Page
Content Placehoder
LeftUpdatePanel
Very large infragistics treeview

RightUpdatePane l
TabContainer User Control
Infragistics tab control - loads another UserControl
for each "tab"
Tab User Control
PROBLEM HERE: Script that is not loading
properly is way down here.

I can try to call a function that does "alert('hello') ;" and the
function is not found.
When I compile the application in release mode without debug=true, all
works fine.

What's going on?? Any ideas?? Thank you very much. I welcome all
comments.

Jul 3 '07 #1
3 2263
I am new to asp.net so i could be way off...
Is it possible that since performace can take a major hit when
debug=true,
that your control isn't yet loaded when you try to access it?
Maybe make your program wait for a sec?
Just a shot in the dark
jojoba

Jul 3 '07 #2
Hi -

Take a look at the actual source your page is producing; is it
including the same javascript function multiple times?(once for each
instance of the control).

If so, this will also produce this error - you can't have more than
one JS function of the same name.

To get around this problem, you can either:

A) Generate the javascript dynamically, appending the ClientID to the
control after every reference of the function name (including the
function declaration)

B) Put the Javascript in a seperate file, and manually include this
file once on every page that uses your control. (do a search on client-
side includes)

Solution A is ideal if you plan on distributing the control amongst a
team or selling it. It's the better approach from a OOP point of view.
Unfortunately, by doing so, you end up with sloppy and overly verbose
HTML. Solution B) allows for cleaner output, but it might make you
scratch your head the next time you try to use this control.

You may be able to work with a third option wherein the controls
determine (through a shared variable, perhaps) whether or not there is
another control of the same type on the page, and whether or not the
client side include has already been written out, but that may be
more complicated than your project mandates.

Good Luck,

-Mark

Jul 3 '07 #3
Awesome suggestions. Yep, I've tried all that.

Most code is in external files. The code that does not work is in the
page (user control) since it references page elements. I don't think
I have multiple copies of the functions loading since it fails on the
first time through.

.... And why would this only happen when compiled with debug mode ==
true??

The only thing I'm embarrased to say that I haven't tried yet is to
view the actual source. "View source" will not work since this is all
in UpdatePanels and Infragistics tabs. I'll need to download
"Fiddler" to look at the data coming back.

Thanks for your suggestions.

Jul 3 '07 #4

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

Similar topics

2
2316
by: Jon Haakon | last post by:
Hi, I'm developing a websolution using ASP and DHTML technology that's running on a MS IIS webserver. My solution is frame based with a toolbar on top, a hidden frame for scripts in the middel (all actions run here), and on bottom html pages will be shown. The bottom page contains forms witch is developed with a 3ed party design tool from Acrobat and stored as HTML. It wouldn't be any problem storing these files as html. But the main...
3
1199
by: Bernie Yung | last post by:
Hi, We have a problem now that som of our clients are using a slow connection, and because the complexity of the ASPX pages it takes a long time to load the page including many javascript. Is there a general way to disable the page before the page finishes loading? thanks
1
2142
by: John Smith | last post by:
Hey folks, Got a weird one for you that I think may just be a bug with Internet Explorer. I have a page that hosts an IFrame. When I call Javascript in my page to change the source of the IFrame, the blue bar in Internet Explorer starts moving as if it's loading. The problem is, the blue bar never finishes even after the page has completed loading. And yes, I am 110% certain the page has completed loading (including all js stuff). ...
18
2197
by: Mark | last post by:
Hello. I am looking for a way to download and cache a web page that the user has not yet requested, and write the web page to the browser cache without displaying it. My intention is to improve display performance when the user eventually requests the cached document. Is there a way to do this in Javascript? Thanks
4
1285
by: Tim | last post by:
Hello, I have a web page that a user enters in information and selects some products. On submit the page the info is saved to a db, connects to third party web apps and retrieves data, and third party data is saved. I want to be able on submit is redirect the user to a loading page (status) while the app is doing the above functionality and then when finished user is redirect to a new page (results). I really do not know where to...
2
1879
by: www.gerardvignes.com | last post by:
I am using this to load the client JavaScript for a web application when it is selected by the user) via an Ajax connection to the server. I have found only two ways of loading new JavaScript after the web page is loaded. 1. Create a new script element (where head is the id of the head tag): var s = document.createElement('script'); s.setAttribute('type','text/javascript'); s.setAttribute('src', 'scripts/myscript.js');
13
3981
by: Marvin Zhang | last post by:
Hi, I'm not familiar with web programming, but I have a problem here. I have a page. When a user click one button on it, I will use AJAX to request a PHP script which will do a bunch of tasks, asynchronously. These tasks might take long time so I want to keep the user informed of the progress. The problem is that only the PHP script knows the progress, how can the web page gets these information from PHP script?
1
1390
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hello misters and miss, I have an application web in asp.net 2.0. I have an Main.aspx page that include javascript code like this: window.location.href = 'anotherpage.aspx'; I want do this: while IExplorer do request to anotherpage.aspx page and anotherpage.aspx is loading, I want to show a message "Loading page" in the Main.aspx page.
3
2724
by: The alMIGHTY N | last post by:
I have an XSL file that works with a typically large XML data set generated dynamically from a database. This data is written to the HTML result as a deep multi-dimensional array that is used by Javascript functions to build large expanding/collapsing tables to display the data. The original developer wrote the page so that many writeln functions were called in embedded Javascript to actually write the table as the page was loading....
0
7969
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7886
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5431
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3927
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2404
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1494
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.