Skip to main content
A newer version of this page is available. .

How to Register Scripts Loaded in Callbacks

  • 2 minutes to read

If a script is loaded in a callback, browsers do not recognize it. DevExpress controls implement a client-side mechanism that evaluates and executes external and inline scripts passed to a client in callbacks.

Register an External Script

An external script is loaded from an external file. This script is registered only once for the first callback. Add the dxis_ prefix to the id attribute value to register an external script.

<script id="dxis_myCode1" src="MyJavaScript.js" type="text/javascript"></script>  

View Example: How to register and execute a JavaScript downloaded to the client via a callback (standalone JS file)

Register an Inline Script

An inline script is embedded in HTML. This code is registered and executed on every callback. Add the dxss_ prefix to the id attribute value to register an inline script.

<script id="dxss_myCode2" type="text/javascript">  
  alert("This is custom script block");  
</script> 

View Example: How to register and execute a JavaScript downloaded to the client via a callback

Access a Script Specified in Another Callback Container

If you load a script in the ASPxCallbackPanel container’s callback and then use the script outside the container, you should explicitly assign functions in your script to the global window object.

<script id="dxss_myCode3" type="text/javascript">  
  window.showText = function () {  
    alert('showText');  
  }  
</script>

<input type="button" value="Show text" onclick="window.showText();"/>