Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>When you are calling "MyFunction" what is it you hoping to achieve? I mean that as are you trying to call it so that each javascript function in the three controls you have on the page executes concurrently so that the value is populated in each control from the Ajax callback.</p> <p>Or are you attempting to call a specific function in each control based on certain constraints?</p> <p>Each case has a different answer. For example, in the first case, this is purely theoretical but when you declare MyFunction can you continually build up the single function eg:</p> <pre><code>if(MyFunction != null) { var oldFunction = MyFunction; MyFunction = new function(){ //new code here; oldFunction(); } } else { //Create it as you were but assign it to MyFunctino } </code></pre> <p>If it's the latter where you want to call each MyFunction based on specific constraints, is there anyway you can, for example take the Asp Controls id and append it to the function name so you create a unique function but then i am unsure how your calling it so this may or may not help.</p> <p><strong>Edit:</strong></p> <p>I understand a bit more about your problem now. I'm assuming at the moment that which ever one of your three controls that you click, it always executes the first one it finds so it just reloads the data into the first control?</p> <p>The crux of your problem is two fold:</p> <ul> <li>There is no differentiation between the function name your controls outputs to the page. </li> <li>The control values your setting in your function on success of ajax callback i'm assuming reference more than one html control on the page?</li> </ul> <p>From the JQuery function you posted, I can't see exactly why you need to have this pasted into the control each time as I don't see any server side variable output?</p> <p>My suggestion would be to create one function in the parent page that all your controls use. You explicitly state that you can't due to server side variables, but if that is the case then modify your GetData() function to take in more parameters so that these define the context it should run in rather than from what control it is outputted from.</p> <p>Potentially pass in the controlid as a parameter to the jquery function as well which it could use as another selector to find the relevant html controls to populate the values on callback.</p> <p>Outputting a function multiple times should provoke the question "am i doing it right?" rather than "how can i get this to work?".</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload