Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How to prevent JavaScript conflict in custom server control (when added more than once to a page)

Reply
Thread Tools

How to prevent JavaScript conflict in custom server control (when added more than once to a page)

 
 
MGKR
Guest
Posts: n/a
 
      02-09-2009
How do you go about solving this?

Ie. unless the JavaScript, included with the server control (which might
reference ID's in the generated HTML), somehow knows which control it
belongs to - A problem will occur if two or more of the same control are
included on the same page.

It's no problem ensuring that unique ID's are generated for each use of a
particular control - But then what with the JavaScript referencing those
ID's?

Are there any general Pattern&Practice for solving this?

I've searched high and low on the net without much luck.

Would very much appriciate some pointers to some links that dig into this
subject..


/MGKR


 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      02-09-2009
Well, you can always generate a separate function for each instance of the
control and give the function a name like <CONTROLID>_myfunction(). However,
if the JavaScript is being used with instances of the same control there is
usually a way to write it so that the same JavaScript can be used for all
instances, often by passing a few extra parameters. If you tell us exactly
what your control's JavaScript is supposed to do we may be able to make a
few suggestions. Good Luck!
--
Nathan Sokalski

http://www.nathansokalski.com/

"MGKR" <no-> wrote in message
news:%...
> How do you go about solving this?
>
> Ie. unless the JavaScript, included with the server control (which might
> reference ID's in the generated HTML), somehow knows which control it
> belongs to - A problem will occur if two or more of the same control are
> included on the same page.
>
> It's no problem ensuring that unique ID's are generated for each use of a
> particular control - But then what with the JavaScript referencing those
> ID's?
>
> Are there any general Pattern&Practice for solving this?
>
> I've searched high and low on the net without much luck.
>
> Would very much appriciate some pointers to some links that dig into this
> subject..
>
>
> /MGKR
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How-To: Prevent Ad-Rotator from Displaying the Same Ad More than Once Superman ASP .Net 0 02-27-2007 11:39 PM
How to prevent query string values from being used more than once? keithb ASP .Net 4 04-08-2006 12:25 AM
How to prevent loading data from database more than once? antonyliu2002@yahoo.com ASP .Net 2 10-10-2005 10:35 PM
Regex to match say char 't' exactly once in a string and no more than once Gancy Perl Misc 4 02-03-2005 02:05 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57