Tools & Code: Gaia AJAX – Simply The Best AJAX Library Available

The best tools to use for development are those with a minimal learning curve. With the overwhelming amount of information that technical professionals must deal with on a daily basis, constantly learning new technologies while keeping up with the old becomes an almost impossible task. And for technical managers looking to keep their development costs to a reasonable budget, extending project schedules for the inclusion of learning new tools can be a costly endeavor.
AJAX is probably one of the most popular web-based development technologies to come about in a long time. With its increased responsiveness while maintaining a lower ratet in terms of server access, it comes as no surprise that it is one technology that technicians would be most interested in taking advantage of where they can.
Most AJAX libraries require a learning curve, especially if one is using Microsoft AJAX. However Gaiaware’s library provides a set of tools that just about lets developers implement new AJAX functionality almost immediately. This is because the Gaia Framework is designed to provide AJAX server controls that operate in the same fashion as the standard Microsoft controls. In other words, there are no special attributes to worry about, no web services to consider building, and little more than learning the new properties of the controls in order to successfully implement them. What’s more the prices are quite reasonable.
A sampling of Gaia AJAX is shown below, which has been taken freom the introduction from the vendor’s web site. For more general details on this excellent product, see the TECH NOTES web page for this tool and the additional pages noted below…
Black Falcon
Introduction to ASP.NET and Gaia Ajax
Modified: 2008/10/13 02:38 by RugWarrior – Uncategorized
Introduction
Gaia is an ASP.NET Server Control library that abstracts away JavaScript and Ajax. It allows you to write all your web applications in managed code. Some benefits include performance, code model and ease of use. Many controls inherit from the base controls giving you only a small learning curve to get started. Gaia Ajax is compatible with .NET Framework 2.0, 3.0 and 3.5 and Mono. It also features Visual Studio.NET Design Time Support, a nice default Theme and everything from basic to advanced widgets ( Window, Calendar, TabControl, TreeView, etc )
Relevant Pages
Sample Code
The sample code below demonstrate all you need to know to get started with the components. This example only updates a Label on the page.
<%@ Page Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<%@ Register
Assembly="Gaia.WebWidgets"
TagPrefix="gaia"
Namespace="Gaia.WebWidgets" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Ajax Sample</title>
</head>
<body>
<form id="form1" runat="server">
<gaia:Button
runat="server"
ID="btn"
Text="Click me" />
</form>
</body>
</html>
There are three important things in the above code. First you have the Page directive which says something about your page like what language the codebehind file is in, which file implements the codebehind class and what the class name is of your codebehind class and so on. The second important thing is the Register directive which for the above scenario “imports” Gaia.WebWidgets.dll and uses the gaia prefix for giving you access to all WebControls in the “Gaia.WebWidgets” namespace. Already now you can type in “<gaia:” and get intellisense help from Visual Studio for all the Ajax Controls in the Gaia core.
The third and most important thing to understand is the declarative syntax of the Gaia Ajax Button which looks like this:
<gaia:Button runat="server" ID="btn" Text="Click me" />
This declares at the place you are within your HTML a Gaia.WebWidgets.Button which will have the ID of “btn” and the Text of “Click me”. Assuming you now have a codebehind file called Default.aspx.cs containing a System.Web.Page inheriting class called “_Default” you can now already run this and the output will look something like this:

Of course it won’t do anything useful since we have no logic in it at all, but it renders its output.
Most of the Gaia Ajax WebControls inherit from their ASP.NET counterparts, which means that every single property you have in the System.Web.UI.WebControls.Button will also be available to you in a Gaia Ajax Button. And you can use most of its properties, methods and events on the Gaia Button in any event handler.
.NET have a very beautiful event/delegate system which is a true event implementation which makes it easy for your objects to signal interest in events raised by other objects. ASP.NET is a pure event based GUI system which means that when you “Click” the button above, then an Event will be raised which you can “subscribe” to in your codebehind file in C#. To subscribe to the “Click” event of the above button and set the Text property of a Gaia Label you would normally do something like this;
Working Code Sample
Default.aspx
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<%@ Register
Assembly="Gaia.WebWidgets"
TagPrefix="gaia"
Namespace="Gaia.WebWidgets" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Ajax Sample</title>
</head>
<body>
<form id="form1" runat="server">
<gaia:Label
runat="server"
ID="lbl" />
<br />
<gaia:Button
runat="server"
ID="btn"
OnClick="btn_Click"
Text="Click me" />
</form>
</body>
</html>
C# Codebehind
using System;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn_Click(object sender, EventArgs e)
{
lbl.Text = "Hello Ajax World 2.0";
}
}
VB.NET Codebehind
Public Class _Default
Inherits System.Web.UI.Page
Protected Overrides Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
End Sub
Protected Sub btn_Click(ByVal sender As Object, ByVal e As EventArgs)
lbl.Text = "Hello Ajax World 2.0"
End Sub
End Class
Now if you compile and run the above application and then click the Button it will display “Hello Ajax World 2.0″ in your Ajax Label. For those acquainted with ASP.NET AJAX you will notice that first of all there is no ScriptManager, no UpdatePanels and no required WebServices. In Gaia you can update any widget any place on the page from any Gaia Event Handler.
Also if you look at the request and the response with e.g. FireBug, Fiddler or some similar sniffer tool you will notice the compact, secure and efficient data transfer between the client and server.
The HTTP Request and Response dissected
HTTP Request to the server
HTTP Response from the server
About this entry
You’re currently reading “Tools & Code: Gaia AJAX – Simply The Best AJAX Library Available,” an entry on TECH NOTES
- Published:
- November 24, 2009 / 4:03 pm
- Category:
- Tools & Code
- Tags:
- ajax, ajax library, ajax software