Please, ask any questions support@obout.com
1. How to add a reference to AJAXPage in VS?
Go to toolbar menu Project > Add Reference > Click button 'Browse' >
> Find obout_AJAXPage.dll > Click 'Open' > Click OK
3. How to add AJAXPage ASP.NET control to the page?
Copy this line on top of your aspx page
<%@ Register TagPrefix="oajax" Namespace="OboutInc" Assembly="obout_AJAXPage" %>
Your page must be derived from OboutInc.oboutAJAXPage
To reference the object on client side, you need to use
ob_post.
4. Can I use more than one AJAXPage ASP.NET control on the page?
You do not need to use more AJAXPage ASP.NET controls on the page.
If you want to callback different data to different pages, you can use the same AJAXPage web component.
What you need to do is to call the
post function with different parameters.
For example, you can use this syntax:
ob_post.post(null, "myServerMethod1");
ob_post.post("ProcessPage2.aspx", "myServerMethod2");
ob_post.post("ProcessPage3.aspx", "myServerMethod3");
using the same AJAXPage component.
5. Does AJAXPage work with ASP classic too, or only with ASP.NET?
Unfortunatelly this web component does not work with ASP classic, only with ASP.NET.
6. AJAXPage could not be initialized.
Please make sure you have a
<head>tag defined for your page.
If you don't, and from any reason you don't want to define one, make sure you define
ScriptPlaceHolderproperty.
See also
ScriptPlaceHolder documentation.
7. Can client scripts call server-side methods with parameters?
Client scripts can call server-side methods with parameters using
post method.
You can add an indefinite number of parameters using the
AddParam method, or using the
post method.
The parameters you add must have a correspondent on the server-side method that manipulates the data.
The server-side method needs to be declared public.
Client Side
// using AddParam
AddParam("yearBorn", 1982);
AddParam("yearNow", 2006);
AddParam("name", "John");
alert(ob_post.post(null, "ComputeAge"));
// using post
alert(ob_post.post(null, "ComputeAge", null, {"yearBorn":1982, "yearNow":2006, "name":"John"}));
Server Side
public string ComputeAge(string name, int yearBorn, int yearNow)
{
int age = yearNow - yearBorn;
return name + " is " + age + " years old."
}
For more information please check
post method documentation.
See also:
AddParam tutorial.
8. How to call client-side functions from server-side?
Server-side methods can trigger a client-side function in two ways:
-
Before the processing starts using ExecBeforeLoad.
-
After the processing is over using ExecOnLoad.
See also:
ExecBeforeLoad and
ExecOnLoad tutorials.
9. How can the data be sent to the server?
You can send data to server in two ways:
-
synchronously
The client waits for the server response before continuing.
If you need to execute the callback and process the response sequentially, then this is the approach you need.
ob_post.post(null, "myServerMethod");
-
asynchronously
The client sends the request to server and continues its execution.
If you are sending a large amount of data, or if the time required for processing the data is pretty long, then the best way to deal with this is by making a callback with the data asynchronously.
ob_post.post(null, "myServerMethod", myFunction);
For more information please check
Sync vs. Async tutorial.
10. Callback request doesn't work!
Check if function
ob_OnRequestStart is used, and if so, make sure it returns true.
This function is 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.
If this method returns
false, the callback request is canceled.
For more information please check
Client-side documentation.
11. What is a Callback Panel?
A Callback Panel is a container that can contain contain html, js, css and other server controls -
like Obout Calendar, Obout EasyMenu, ASP.NET controls (ASP Textbox, ASP DropDownList, etc.).
It is very useful to load dynamic scripts, dynamic stylesheets, dynamic controls, etc.
<oajax:CallbackPanel runat="server" ID="callbackPanel1"> <content> <asp:Literal id="literalControl" Runat="server"></asp:Literal> <span>html content
</span> </content> <loading> Loading...please wait
</loading> </oajax:CallbackPanel>
For more information please check Callback Panel
How It Works page.
12. How can I update a Callback Panel?
The update of the panel is done without reloading the page.
It can be done:
- Client-side
ob_post.UpdatePanel("callbackPanel1");
ob_post.UpdatePanelInContainer("callbackPanel1", "container");
ob_post.UpdatePanelFromPage("callbackPanel1", "container", "callbackPanels.aspx");
ob_post.UpdateAllPanels();
-
Server-side
UpdatePanel("callbackPanel1");
UpdatePanel("callbackPanel1", "container");
UpdateAllPanels();
View
UpdatePanel tutorial.
View
UpdatePanelInContainer tutorial.
View
UpdatePanelFromPage tutorial.
View
UpdateAllPanels tutorial.
13. CallbackPanel doesn't update!
Check if function
ob_OnBeforePanelUpdate is used, and if so, make sure it returns true for
the specified panel.
This function is invoked before a panel is updated at client side (before the request is sent to server to request for an update to the panel).
ob_OnBeforePanelUpdate(panelID, containerID, page)
- panelID - Panel id to update - null if request was made to update all panels.
- containerID - Container in which to store the panel's content - null if panel updates itself in its own container.
- page - Page where the panel is declared.
If this method returns
false, the update is canceled.
For more information please check
CallbackPanel Client-side documentation.
14. Is exception handling allowed?
The AJAXPage ASP.NET control has 2 properties helpful for exception handling, testing and debugging:
- ShowErrorsAtClient: when this property is set to true, an alert box will appear
when an error occurs, with details about the error.
An alert box will also appear for exceptions thrown by the user.
The default value for this property is true.
- ThrowExceptionsAtClient: when this property is set to true, an exception will be thrown
whenever something goes wrong.
The default value for this property is false.
15. Can I handle the exceptions client side?
The exception handling is different for Synchronous Callback and for Asynchronous Callback.
Synchronous Callback:
try{
alert(ob_post.post(null, "onEvent"));
}
catch(ex){
switch (ex.type){
// based on the exceptionType do specific instructions
case ...
}
}
Asynchronous Callback:
ob_post.post(null, "onEvent", myFunction);
function myFunction(result, ex){
if (ex != null){ // equivalent to if (result == null){
switch (ex.type){
// based on the exceptionType do specific instructions
case ...
}
}
else{
// if there was no exception
}
}
Please visit the debugging examples for
synchronous and
asynchronous callback.
16. How to add Callback Panel to the Toolbox in VS?
Go to toolbar menu Tools > Add/Remove Toolbox Items... > Click button 'Browse' >
> Find obout_AJAXPage.dll > Click 'Open' > Click OK
Or, in the Toolbox window, right-click on the tab you want to add the control and choose "Add/Remove Items..." and follow the steps described above.
You will now find the Callback Panel ASP.NET control in your toolbox, next to this icon:
17. Can I add Callback Panel at run time?
Yes, you can add Callback Panel at run time as any other ASP.NET control.
OboutInc.CallbackPanel callbackPanel1 = new OboutInc.CallbackPanel();
callbackPanel1.ID = "callbackPanel1";
Page.Controls.Add(callbackPanel1);
When you'll try to update the panel first make sure it still exists as a control of the
Page control.
I recommend to add the panel inside the
Page_Load event.
Please, ask any questions support@obout.com