Click here to Skip to main content
Click here to Skip to main content
Articles » Web Development » Ajax » General » Downloads
 
Add your own
alternative version

Magic AJAX: Applying AJAX to your existing Web Pages

, 28 May 2007 MIT
How to apply AJAX technologies to your web pages without replacing ASP.NET controls and/or writing JavaScript code.
magicajax-030-net11.zip
magicajax
Examples
ExampleSite (.NET 2.0 only)
Web.sitemap
webparts
images
first.GIF
last.GIF
next.gif
pow_by_aspnet2.0.gif
prev.GIF
examples
App_Data
App_Code
Docs
Core
script
bin
MagicAjax.dll
magicajax-030-net20.zip
MagicAjax.dll
Web.sitemap
first.GIF
last.GIF
next.gif
pow_by_aspnet2.0.gif
prev.GIF
magicajax-030-source.zip
Web.sitemap
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
first.GIF
last.GIF
next.gif
pow_by_aspnet2.0.gif
prev.GIF
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries
Entries.Extra
Entries.Old
Entries.Extra.Old
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
CVS
Root
Repository
Entries
Entries.Extra
Entries.Old
Entries.Extra.Old
MagicAjax.snk
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
UI
Design
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
Controls
ClientEventControls
CVS
Root
Repository
Entries.Old
Entries
Entries.Extra.Old
Entries.Extra
CVS
Root
Repository
Entries.Extra
Entries.Old
Entries
Entries.Extra.Old
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
Interfaces
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
Configuration
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
CVS
Root
Repository
Entries
Entries.Extra
Entries.Old
Entries.Extra.Old
CVS
Root
Repository
Entries.Old
Entries.Extra.Old
Entries
Entries.Extra
magicajax.zip
AJAXTest
AJAXTest.csproj.webinfo
Global.asax
Ajax
Ajax.csproj.user
Controls
Design
script
using System;
using System.Web;

namespace Ajax
{
	/// <summary>
	/// Includes the CallBack event, Context, Request and Response, for convenience.
	/// </summary>
	/// <remarks>
	/// You can implement the ICallBackEventHandler on your usercontrol to handle the
	/// CallBack event, and use the HttpContext.Current, CallBackHelper.Request and
	/// CallBackHelper.Response properties.
	/// 
	/// You cannot use the Context, Request and Response of the System.Web.UI.UserControl
	/// because, during a CallBack, the Context of the page is invalid. If you don't want
	/// to replace the UserControl.Request and UserControl.Response from your code for
	/// CallBackHelper.Request and CallBackHelper.Response, and your usercontrol is inherited
	/// from System.Web.UI.UserControl, you can use AjaxUserControl for convenience.
	/// </remarks>
	public class AjaxUserControl : System.Web.UI.UserControl, ICallBackEventHandler
	{
		/// <summary>
		/// Raised by AjaxHttpModule when a CallBack occurs
		/// </summary>
		public event EventHandler CallBack;

		/// <summary>
		/// The base UserControl Request property doesn't work during a CallBack. Use this instead.
		/// </summary>
		public new HttpRequest Request
		{
			get
			{
				return Context.Request;
			}
		}

		/// <summary>
		/// The base UserControl Response property doesn't work during a CallBack. Use this instead.
		/// </summary>
		public new HttpResponse Response
		{
			get
			{
				return Context.Response;
			}
		}

		/// <summary>
		/// Raises the CallBack event.
		/// </summary>
		/// <remarks>
		/// Called by AjaxHttpModule.
		/// </remarks>
		public void RaiseCallBackEvent()
		{
			OnCallBack (EventArgs.Empty);
		}

		protected override HttpContext Context
		{
			get
			{
				return HttpContext.Current;
			}
		}

		protected virtual void OnCallBack(EventArgs e)
		{
			if (CallBack != null)
				CallBack(this, e);
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License

Share

About the Author

Argiris Kirtzidis
Web Developer
Greece Greece
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 28 May 2007
Article Copyright 2005 by Argiris Kirtzidis
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid