The Code section allows you to add Server-side and Client-side Event handlers, custom Xbasic Functions, and Javascript Functions to your grid. You can adapt your code to examine the contents of a grid, properties of a grid, and the data being submitted. You can then take action to modify values or even cancel the submission.


Xbasic and JavaScript can be added to the Grid component to provide custom server-side or client-side scripts for calculating values or handling events. Code can be added in several ways in the Code section: to a Server-side or Client-side event, as a custom Xbaic Function, as a custom Javascript Function.

There are separate, modeless editing panes for Server-side Events, Client-side Events, Xbasic Functions, and JavaScript Functions. All four panes do syntax-coloring and auto-suggest as you type. All four pane have companion tabs for an Interactive Window for the appropriate language, Xbasic or JavaScript, and have links to dialog that help you insert commonly used expressions for the event context. The two Events panes have event selectors, and the Client-side Events pane has a filter for the event


Each pane has its own editing toolbar. The Xbasic Functions and Server-side Events toolbars include a Check Syntax button for Xbasic. All four toolbars have buttons for cut, copy, paste, undo, redo, find, replace, indent, outdent, left align, format code, transform code, comment out, and un-comment out.


The Code section provides access to the following places where code can be added:

  • Server-side Events
  • Client-side Events
  • Xbasic Functions
  • Javascript Functions

Server-side Xbasic Event Code Pane

The Server-side Events code pane lists server-side events for the Grid. Custom Xbasic can be added to these events to do things such as data validation, calculate field values (such as timestamps or record IDs), set session variables, etc. See Grid Server-side Events for more information about these events.


Client-side Javascript Event Handlers Pane

The Client-side Events code pane lists client-side events for the Grid. Custom JavaScript can be added to these events to do things such as data validation, display popup messages, and more. See Grid Client-side Events for more information about these events.


The Xbasic function definitions Pane

The Xbasic Functions section allows you to define Xbasic functions that can be called from Xbasic event handlers. These functions are called by server side actions defined in the grid 'Events' (see Grid Server-side Events and Ajax Callbacks.)

The 'e' pointer variable used in most event handlers may carry different properties for different handlers. The function prototype for each event handler contains comments that explain the properties for that handler and show a typical implementation of that handler.

Further information in the properties carried by the 'e' pointer variable for a specific handler on a specific grid may be obtained by debugging the event handler and inspecting the 'e' variable.


The Javascript Function Pane


See Also