Saturday, 06 September 2008
DotNetSpace, Asp.net 2.0 tutorials and code examples. ajax, log4net...
Home arrow Articles arrow General Articles arrow Simple Ajax example using MagicAjax
 
Main Menu
Home
Articles
News
Links
Search








BiraJones




Simple Ajax example using MagicAjax Print E-mail
Saturday, 25 November 2006

MagicAjax.NET is an open-source framework designed to make it easier and
more intuitive for developers to integrate AJAX technology into their web pages,
without replacing the ASP.NET controls and/or writing tons of AJAX javascript code.

This example shows how to multiply two TextBox values and put the result in the third TextBox using AJAX.
More information and application download in: www.magicajax.net

Steps:

# 1- Download the MagicAjax AJAX framework from www.magicajax.net
# 2- In Visual Studio->WebSite->AddReference add a new reference to MagicAjax.dll that you downloaded.
(Click in browse then search for the MagicAjax.dll file in the MagixAjax bin folder)

# 3- Put this in the beginning of web.config file before appSettings tag:

 

<configSections>
    <section name="magicAjax" type="MagicAjax.Configuration.MagicAjaxSectionHandler,MagicAjax"/>
</configSections>
<magicAjax outputCompareMode="HashCode" tracing="false">
    <pageStore mode="NoStore" unloadStoredPage="false" cacheTimeout="5" maxConcurrentPages="5" maxPagesLimitAlert="false"/>
</magicAjax>

 

 # 4- The put this inside the system.web tag:

 

<httpModules>
    <add name="MagicAjax" type="MagicAjax.MagicAjaxModule, MagicAjax"/>
</httpModules>

 

Now you are ready to use MagicAjax! Lets continue: 

 # 5- Put this code in all pages you want to use ajax. This need to be after the <%@ Page Language...
in the beginning of the .aspx file:

 
<%@ Register Assembly="MagicAjax" Namespace="MagicAjax.UI.Controls" TagPrefix="ajax" %>

 

# 6- Put the following code before and after the html code that you want to be processed using AJAX. Example:

 
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register Assembly="MagicAjax" Namespace="MagicAjax.UI.Controls" TagPrefix="ajax" %>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <br />
        <ajax:AjaxPanel ID="ap" runat="server" Width="451px">
        
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>&nbsp;
        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" />
        <br />
        <br />
        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
        
        </ajax:AjaxPanel>
        &nbsp;</div>
    </form>
</body>
</html>

 
# 7- Source code example:

MagicAjaxExample.zip

 

That is it! This is a very simple example, but is all you need to start using the power of AJAX!!!
Good luck!

Last Updated ( Tuesday, 28 November 2006 )
 
Next >
Popular
Polls
-->*/?>

Which language will you choose for coding with Visual Studio .NET?
 
-->*/?>

Is ASP.NET better than Java / JSP frameworks?
 

© 2008 DotNetSpace
Joomla! is Free Software released under the GNU/GPL License.