Edit Prerequisites
- Install Visual Studio
- Install Gaia Ajax.
- download a 30-days trial or
- purchase a license
EditIntroduction
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 ASP.NET 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 Design Time Support, a built-in, nice default Theme and everything from basic to advanced widgets ( Window, Calendar, TabControl, TreeView, etc )
EditRelevant Pages
- Key Features in Gaia
- About Gaia
- Considerations when choosing an ajax framework
- Read more about ASP.NET Web Forms at www.asp.net
EditSample 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" %>
Ajax Sample
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:
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;
EditWorking Code Sample
EditDefault.aspx
<%@ Page
Language="C#"
AutoEventWireup="true"
CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<%@ Register
Assembly="Gaia.WebWidgets"
TagPrefix="gaia"
Namespace="Gaia.WebWidgets" %>
Ajax Sample
EditC# 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";
}
}
EditVB.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.
EditThe HTTP Request and Response dissected
EditHTTP Request to the server
GaiaCallback=true&btn=Click me&_GAIA_FILES=670143809%241623831675%24574948095%242060931379%24-292782845
%24-1257833369%24-1746062492&_EVENTVALIDATION=%2FwEWAgLb2K%2BZDwKSoqqWDy5qphZGVxq2ILnQH65uU7MgWEMp&_VIEWSTATE
=%2FwEPDwULLTIwMjA3NTk0MzEPZBYCAgMPZBYEAgEPDxYCHgtIYXNSZW5kZXJlZGdkZAIDDw8WAh8AZ2RkZBAKnl80pWgpTvyWiRBK
%2BusY%2FqVO
EditHTTP Response from the server
$G('lbl').setText('Hello Ajax World 2.0');
$FChange('__VIEWSTATE', 43, 'EHgtIYXNSZW5kZXJlZGceBFRleHQFFEhlbGxvIEFqYXggV29ybGQgMi4wZGQCAw8PFgIfAGdkZGSL1pk
b0d1wQuK4M9lMGeOIWhPkMA==');Gaia.Control.setUpdateControl(null, true);
EditImportant Topics to fully leverage Gaia Ajax in ASP.NET Development
- ViewState In Gaia Ajax
- Page Life Cycle Explained