dimanche 8 février 2009

How to Implement Something Like "AJAX" in your ASP.Net Page!

In .Net framework 2.0 and upper, there's some AJAX controls that you can "DRAG&DROP" to your ASP.Net page, to have a Asynchrone communication with server IIS.

But you don't know how they communicate! the "Asynchrone communication procces" it's hidden of you and you want Understand it!

I will show you ;)

+Create a Aspx Page like this:

-each time you write something in inputText the keyup Event raise a callBack to Server .

+ in Aspx Page Code behind:
  • Page_Load():
in Page_Load we register the Ajax client script to the client's browser and create a list of string (the source) that contains some names.
The Page must implement ICallbackEventHandler to Catch CallBack Event from Client!
  • ICallbackEventHandler
when implementing ICallbackEventHandler, two methods are added:
  • RaiseCallbackEvent: Catch a CallBack event from Client.
  • GetCallbackResult: return a CallBack result to Client.

Now your page is Fully Ajax => Run & Test!

Aucun commentaire:

Enregistrer un commentaire

Rechercher dans ce blog