AJAX Page Documentation - Server-Side

Methods, Properties, Attributes

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

Methods

Name Description
methodExecBeforeLoad Triggers a client-side function from the server, before the data processing starts.

ExecBeforeLoad(clientFunction)
  • clientFunction - Javascript function that will be executed. Can be a javascript code or the name of a javascript function.
ExecBeforeLoad("alert('some text')");

View ExecBeforeLoad tutorial.
methodExecOnLoad Triggers a client-side function from the server, after the processing is over.
Scripts added with this method are not executed on a synchronous callback and if errors are turned on, it will be reported as an error.

ExecOnLoad(clientFunction)
  • clientFunction - Javascript function that will be executed. Can be a javascript code or the name of a javascript function.
ExecOnLoad("alert('some text')");

View ExecOnLoad tutorial.
methodEndResponse Stops the execution at server-side and returns to the client the data processed until that moment.

EndResponse()

Does not require any parameters.

EndResponse();

View EndResponse tutorial.
methodRedirect Redirect to another page.

Redirect(pageURL, endResponse)
  • pageURL - URL of the page where you will be redirected.
  • endResponse - Specifies if the processing of the current page should end.
    If true, the processing of the current page is over. Default value is false.
    Optional.
Redirect("SomePage.aspx");
Redirect("SomePage.aspx", true);
methodShowAlert Shows an alert window with the specified message on client side.

ShowAlert(message)
  • message - Text that will be displayed inside an alert box.
ShowAlert("This alert was sent by server");

View ShowAlert tutorial.
methodSetValue Set the value of an element with specified id.

SetValue(elementID, value);
  • elementID - Element id.
  • value - New value for the element.
SetValue("textElement", "some value");

View SetValue tutorial.
methodOpenWindow Open a new window at client.

OpenWindow(pageURL, mode, properties, replace);
  • pageURL - Open window URL.
  • mode - Open window mode. Available values are _bank, _self, _parent, _top.
  • properties - Window properties.
  • replace - Specifies whether the URL creates a new entry or replaces the current entry in the history list.
    The following values are supported:
        true - URL replaces the current document in the history list
        false - URL creates a new entry in the history list
  • Optional.
OpenWindow("Postback2.aspx",);
OpenWindow("Postback2.aspx", "_blank",);
OpenWindow("Postback2.aspx", "_blank", "width=400, height=250");
OpenWindow("Postback2.aspx", "_blank", "width=400, height=250", true);


View OpenWindow tutorial.
methodShowConfirmationDialog Shows a confirm dialog box with a specified message.
If the answer is Yes, server method is executed with the specified list of parameters.

ShowConfirmationDialog(message, serverMethod, parametersList);
  • message - Text displayed inside confirmation dialog.
  • serverMethod - If the answer is yes, serverMethod is called.
  • parametersList - List of parameters for myFunction. Optional.
Hashtable ht = new Hashtable();
ht.Add("param1", 1);
ht.Add("param2", "a");

ShowConfirmationDialog("Are you sure?", "Confirm", ht);

public string Confirm (bool response, int param1, string param2)
{
return "some text";
}


View ShowConfirmationDialog tutorial.
methodCreateTimer Creates a timer, with an ID, that will trigger a client function on a time interval.

CreateTimer(ID, clientFunctionToCall, interval);
  • ID - ID of the timer.
  • clientFunctionToCall - Function to call on client.
  • interval - Time in milliseconds on which the clientFunctionToCall is called.
CreateTimer("timerID", "myClientFunction()", 1000);


Creates a timer, with an ID, that will trigger a server function on a time interval.

CreateTimer(ID, serverFunctionToCall, clientFunctionToCall, interval);
  • ID - ID of the timer.
  • serverFunctionToCall - Server side function that will be called at every interval, and which can return something that clientFunctionToCall can process.
  • clientFunctionToCall - Client side function that will be called with the result of serverFunctionToCall.
    If you need no client side function to be called, just set it tonull.
  • interval - Time in milliseconds on which the serverFunctionToCall is called.
CreateTimer("timerID", "myServerFunction", "myClientFunction()", 1000);
CreateTimer("timerID", "myServerFunction", null, 1000);

View CreateTimer tutorial.
methodCancelTimer Cancel the timer specified by its ID.

CancelTimer(ID);
  • ID - ID of the timer.
CancelTimer("myTimer");

View CancelTimer tutorial.
methodRegisterScript Registers a client script block.

RegisterScript(ScriptKey, Script);
  • ScriptKey - The key of the client script block to register. Must be unique.
  • Script - The client script script block to register.
RegisterScript("alertScript", "alert('this is an alert')");

methodRegisterScriptFile Registers a client script resource file.

RegisterScriptFile(ScriptFileKey, ScriptFilePath);
  • ScriptFileKey - The key of the script file resource to register. Must be unique.
  • ScriptFilePath - The client script file path.
RegisterScriptFile("scriptResource1", "http://localhost/MyWebsite/ScriptFile.js");

methodRegisterStyleFile Registers a css style resource file.

RegisterStyleFile(StyleFileKey, StyleFilePath);
  • StyleFileKey - The key of the css style file resource to register. Must be unique.
  • StyleFilePath - The css style file path.
RegisterStyleFile("styleResource1", "http://localhost/MyWebsite/StyleFile.css");

Properties

Name Description
propertyIsCallback Returnstrueif the call is a callback,falseotherwise.
propertyUpdatePanelParams Returns an Hashtable list of parameters added before a client panel update using ob_post.AddParam client method.
propertyEnableCallbackViewState If true, the ViewState will be available during callbacks.
Also check this live example.
propertyRequestTimeoutMilliseconds The timeout in milliseconds after which a request is considered to be timeout.
This time is calculated from when the request is initiated - ob_OnRequestStart.
When it expires, ob_OnTimeout function is called.
propertyThrowExceptionsAtClient Whether or not to throw an exception at client when an error occurs.
propertyShowErrorsAtClient Whether or not to show an alert box at client when an error occurs with details about the error.
propertyScriptPlaceHolder Specify the ASP Literal control where the component client script will be generated.
If none specified, the script will be generated inside<head>tag of your page.
propertyServerFileName Name of the file where the data is processed.
If none specified, the data will be sent to the same page.

Attributes

Name Description
propertyJSVisible Using this attribute to a server method makes your method available also on client side.

View JSVisible tutorial.