UserControl loaded dynamically multiple times on same page....client js problem

I

ibejo

OK - I have a user control that I have written. I load it multiple
times on the same page with different data. It uses a server side
javascript file that contains some DHTML / JS. The problem appears to
be that since each instance of the control shares the same .JS file,
there appears to be collisions where one control is overwriting values
in the .JS that was set by the other control.

Is there some way to have each user control have its own instance of
the same JS file?

Any help greatly appreciated!
 
A

Alessandro Zifiglio

hi, this is basically a scripting issue, that you should try and resolve in
your js.
Your js needs to be able to deal with multiple elements calling and using
the same piece of code while preserving scope.
Try an object oriented approach in you way of writing js code, this way for
each element you can instiantiate a new object with the new operator, and
each call will run within its own scope. Currently your code seems to be
running within a global scope, so its normal that they override values,
specially if you have some variables declared outside your functions these
run in globalscope and are probably the root cause of the problem you are
having.

Regards,
Alessandro Zifiglio
http://www.AsyncUI.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top