Skip to main content

How to Register Scripts Loaded in Callbacks

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>  

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");  

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 () {  

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