AJAX Page Documentation - Client-Side

Methods, Properties,
Events Request, Events Response, Events Timeout

<%@ Register TagPrefix="oajax" Namespace="OboutInc" Assembly="obout_AJAXPage" %>

Methods

Name Description
methodAddParam Adds a new parameter to the callback object.

AddParam(id, value)
  • id - Parameter ID.
  • value - Parameter value.
ob_post.AddParam("Param1", Param1Value);

View AddParam tutorial.
methodResetParams Removes all the parameters added using AddParam method.

ResetParams()

Does not require any parameters.

ob_post.ResetParams();

View ResetParams tutorial.
method post Makes a callback with the data to the server.

post(pageURL, serverMethod, clientFunction, params, throwErrors, throwExceptions)
  • pageURL - URL of server file where data will be sent and processed.
    Optional. If it's null, the data will be sent to the same page.
  • serverMethod - Name of the server-side method to process data.
    The server-side method needs to be declared public.
  • clientFunction - The client-side function called when the asynchronous callback is done. Optional.
  • params - Specify the parameters for the server function in the same call as ob_post.post instead of using ob_post.AddParam.
    This:
    ob_post.AddParam ("param1", value);
    ob_post.AddParam("param2", value);
    ob_post.Post(null, "myServerMethod", myFunction);
    and this:
    ob_post.Post(null, "myServerMethod", myFunction, {"param1":value, "param2":value});
    are equivallent.
    In case of a synchronous callback with specifying parameters, the myFunctiion parameter can be null. Optional.
  • throwErrors - Override existing setting of ShowErrorsAtClient property, but only for this callback operation.
    Optional. If not used, default setting is used.
  • throwExceptions - Override existing setting of ThrowExceptionsAtClient property, but only for this callback operation.
    Optional. If not used, default setting is used.
ob_post.post(null, "myServerMethod", myFunction);

ob_post.post("ProcessPage.aspx", "myServerMethod", myFunction);

ob_post.post("http://www.site.com/ProcessPage.aspx", "myServerMethod", myFunction);

ob_post.post(null, "myServerMethod", myFunction, {"param1":paramValue1, "param2":paramValue2});

Properties

Name Description
propertyresponse Response object returned by the server side function called.
This object is available only when a script is run using ExecBeforeLoad method.

It has the folowing properties:
  • content - The content of the response sent by server function.
  • allowReturn - Specifies if the client function that should receive the answer
    (the one that was set as third parameter of ob_post.post) should be called.
    Default value is true.
    If set to false, it will not be called.
  • funcToExec - the function that should be executed (the one that was set as third parameter of ob_post.post).
See also Response example.
propertyexception At server side, users can throw exceptions that will be available on client side.
Exception object is available on client side when an exception is thrown from the server.

It has the folowing properties:
  • message - The message of the exception.
  • type - The type of the exception.
View Exception Handling tutorial.
Please also visit the exception handling examples for synchronous and asynchronous callback.

Events - Request

Name Description
methodob_OnRequestStart Invoked before the callback request is initiated to the server.

ob_OnRequestStart(page, serverMethod, params)
  • page - Page to which the request is sent.
  • serverMethod - Method called at server side.
  • params - Params sent for the server method.
In order for the event to be caried out (the panel to be updated/the request to be sent) the function must return true.
If this method returns false, the callback request is canceled.
methodob_OnRequestSend Invoked immediatelly after the request was sent to server for processing.

ob_OnRequestSend(page, serverMethod, params)
  • page - Page to which the request is sent.
  • serverMethod - Method called at server side.
  • params - Params sent for the server method.

Events - Response

Name Description
methodob_OnResponseReceived Invoked as soon as the server sends its response back for the callback request.

ob_OnResponseReceived(page, serverMethod, params, status)
  • page - Page to which the request is sent.
  • serverMethod - Method called at server side.
  • params - Params sent for the server method.
  • status - The response status.
methodob_OnResponseEnd Invoked after all response processing is done.

ob_OnResponseEnd(page, serverMethod, params)
  • page - Page to which the request is sent.
  • serverMethod - Method called at server side.
  • params - Params sent for the server method.

Events - Timeout

Name Description
methodob_OnTimeout Invoked when a request takes longer than the specified number of milliseconds (defined as a property of AJAXPage) to run.

ob_OnTimeout(page, serverMethod, params)
  • page - Page to which callback was made.
  • serverMethod - Server side method that was called.
  • params - Params sent to server method.
If this method returns true, the request is canceled.