473,386 Members | 1,644 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.

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

RightUpdatePanel
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 2254
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
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...
3
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...
1
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...
18
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...
4
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...
2
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...
13
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,...
1
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:...
3
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...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.