Ajax and Atlas conversation with Jeremy

Links of interest

ICallBackEventHandler (MS AJAX implimentation) article (how it works)
http://www.simple-talk.com/2005/08/10/asynchronous-client-script-callbacks

MS Atlas article (THIS ROCKS)
http://www.topxml.com/Biztalk-Adapters/re-21196_Making-a-List-Checking-it-Twice-Cool-Ajax-Sample-App-with-ASP-NET-2-0-and-Atlas.aspx

slightly edited conversation follows

Elliott O'Hara says:
ICallBackEventHandler doesn't use IFRAME
Jeremy Gunn says:
i don't know how it works then
Elliott O'Hara says:

Elliott O'Hara says:

Jeremy Gunn says:
that doesn't post the whole page?
Elliott O'Hara says:
they do post the whole page
Jeremy Gunn says:
ummm
Elliott O'Hara says:
it just doesn't post THAT page
Elliott O'Hara says:
or something
Elliott O'Hara says:
but the page itself executes
Jeremy Gunn says:
huh?
Elliott O'Hara says:
you get everything up untill prerender
Jeremy Gunn says:
makes no sense to me
Elliott O'Hara says:
yeah-- it's **watch your tounge elliott*** wierd
Elliott O'Hara says:
GridView DOES impliment ICallbackEventHandler
Elliott O'Hara says:
so--
Elliott O'Hara says:
here's how ICallbackEventHandler works
Elliott O'Hara says:
it DOES NOT post the whole page
Elliott O'Hara says:
it DOES NOT use an IFRAME
Elliott O'Hara says:
it uses XmlHttpRequest
Jeremy Gunn says:
aha
Jeremy Gunn says:
that's how it works
Elliott O'Hara says:
ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
Jeremy Gunn says:
and the javascript handles the response just like the browser normally handles a normal httpresponse
Elliott O'Hara says:
no
Elliott O'Hara says:
ICallbackEventHandler.GetCallbackResult()
Elliott O'Hara says:
returns a string to the JavaScript method you specified
Jeremy Gunn says:
i would looooooooove to see the javascript function that makes the XmlHttpRequest call
Elliott O'Hara says:
lol
Jeremy Gunn says:
would make everything make sense
Jeremy Gunn says:
i'm sure
Elliott O'Hara says:
it makes sence
Elliott O'Hara says:
I just did a page that does it
Jeremy Gunn says:
find the script
Jeremy Gunn says:
and show it to me

Elliott O'Hara would like to send you the file "ajaxdemo.zip" (3 Kb). Transfer time is less than 1 minute with a 28.8 modem. Do you want to Accept (Alt+T) or Decline (Alt+D) the invitation?

Elliott O'Hara says:
someone sent this to me, just to show me how it works
Elliott O'Hara says:
but it does

Transfer of file "ajaxdemo.zip" from Elliott O'Hara has been accepted. Starting transfer...

You have successfully received C:\Documents and Settings\jgunn\My Documents\My Received Files\ajaxdemo.zip from Elliott O'Hara. Before opening this file, you may want to scan it with a virus-scanning program.

Jeremy Gunn says:
callserver(arg,"")
Jeremy Gunn says:
thats the function i wanted to see
Elliott O'Hara says:
Page.ClientScript.RegisterClientScriptBlock(
this.GetType(),
"CallServer",
"function CallServer(arg,context)\n{" + Page.ClientScript.GetCallbackEventReference(this,"arg","ReceiveFromServer","context") +"};",
true);
Elliott O'Hara says:
i know the casing is wrong-- that's different code
Elliott O'Hara says:
Page.ClientScript.GetCallbackEventReference
Jeremy Gunn says:
GetCallbackEventReference, yeah
Jeremy Gunn says:
that's the rub
Elliott O'Hara says:
nice-- huh?
Elliott O'Hara says:
it's sweet
Jeremy Gunn says:
still don't get it
Jeremy Gunn says:
where is the XmlHttpRequest made
Elliott O'Hara says:
that line will cause ReceiveFromServer to get called when an AJAX post happens
Elliott O'Hara says:
in CallServer
Elliott O'Hara says:
CallServer(args,context){

Elliott O'Hara says:
Page.ClientScript.GetCallbackEventReference(this,"arg","ReceiveFromServer","context") +"}
Jeremy Gunn says:
sending me the same thing won't help any
Jeremy Gunn says:
genius
Elliott O'Hara says:
that'll send the page, and tell it to call ReceiveFromServer
Elliott O'Hara says:
when done
Jeremy Gunn says:
who's "it"
Elliott O'Hara says:
function SendToServer(arg)
{
CallServer(arg,"");
}
function ClassKeyChange()
{
SendToServer(document.getElementById("").value);
}
function ReceiveFromServer(val)
{

var item = document.getElementById("");
//alert(item);
for(var i = 0;ihttp://www.simple-talk.com/2005/08/10/asynchronous-client-script-callbacks
Jeremy Gunn says:
good article
Elliott O'Hara says:
yeah-- it's really simple xxxx man -- (expletive deleted by admin)
Elliott O'Hara says:
nothing to it
Elliott O'Hara says:
can only send a string-- and that's not really that big of a deal
Elliott O'Hara says:
cause last time I checked
Elliott O'Hara says:
THAT'S ALL HTML IS ANYWAY

Elliott O'Hara says:
http://www.topxml.com/Biztalk-Adapters/re-21196_Making-a-List-Checking-it-Twice-Cool-Ajax-Sample-App-with-ASP-NET-2-0-and-Atlas.aspx

Elliott O'Hara says:
Ahhhhhhhhhhhhhhhhhhhh

Elliott O'Hara says:
no way-- with atlas-- you have ContentTemplates... that get updated
Jeremy Gunn says:
idon't know what that means
Elliott O'Hara says:
put a atlas:ContentTemplate around a section on the page
Elliott O'Hara says:
and it'll just repaint that portion
Elliott O'Hara says:
so-- put a gridview in a contenttemplate
Jeremy Gunn says:
sweet
Elliott O'Hara says:
and you wire it up to a control and tell it what event -- and i'll use AJAX to repaint just that portion
Elliott O'Hara says:
http://www.dotnetslackers.com/Atlas/re-17486_Making_a_List_Checking_it_Twice_Cool_Ajax_Sample_App_with_ASP_NET_2_0_and_Atlas.aspx

Elliott O'Hara says:
great article