Anybody knows the very gud technology which every web developers
should know... that is AJAX.... its really beautiful.. its gud to
discuss abt it and also about shadow copy... its really core... till
now i couldn't succeed in that.... trying a lot.... if anyone knows
better do respond...
and please dont give me links... cause i searched through the web for
more than 1 week... i have seen all the links... so please give me
solution directly...
Thank you...
Raj....
Its a very good technology to get data from server without having the
page refreshed.It is achieved by xmlhttpRequest object which work
similar to javascript image object where we can change the image
dynamically without refreshing the page..
Just add reference to the AJAX Dll to your project...
Open the Web.Config file add the ajax handler factory..so that if any
requesr for ajax/*.ashx) is met by server ti will use
Ajax.PageHandlerFactory for handling the request...
so add the folow code in web.config
<configuration>
<system.web>
<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx"
type="Ajax.PageHandlerFactory, Ajax" />
</httpHandlers>
<system.web>
</configuration>
Now add the server side function in webform say getname()
[Ajax.AjaxMethod]
public static string GetName()
{
return "Satheesh babu";
}
Add the attribute [Ajax.AjaxMethod] before all the method that is
called from jscript..
Now Go to the page load..
type..
Ajax.Utility.RegisterTypeForAjax(GetType(WebForm1));
The call to RegisterTypeForAjax emits the following JavaScript on the
page or u can copy this code on ur page..where Sample is the namespace
name,
<script language="javascript" src="ajax/common.ashx"></script>
<script language="javascript"
src="ajax/Sample.WebForm1,Sample.ashx"></script>
Now Add a html Button to the page...
Add a javascript function ...
<script language="javascript">
function fn()
{
var n=WebForm1.GetName();
alert(n.value);
}
</script>
<INPUT onclick="fn()"t ype="button" value="Button">
Now compile and run the page...
This is a simple example to use AJAX in our project..Like this we can
return complex type also from server..
U can download the AJAX dll form Michael Schwarz blog..
http://weblogs.asp.net/mschwarz/
Actually the Ajax Wrapper creates a javascript fuction Sample.Getname()
,So that Client function can able to communicate with the server
functions...
Regards,
Satheesh