<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>All Free Tech &#187; ASP</title>
	<atom:link href="http://www.allfreetech.com/tag/asp/feed" rel="self" type="application/rss+xml" />
	<link>http://www.allfreetech.com</link>
	<description>For developers</description>
	<lastBuildDate>Tue, 01 Feb 2011 13:45:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Client Centric Approach of AJAX using Toolkit</title>
		<link>http://www.allfreetech.com/ajax/client-centric-approach-of-ajax-using-toolkit-151.html</link>
		<comments>http://www.allfreetech.com/ajax/client-centric-approach-of-ajax-using-toolkit-151.html#comments</comments>
		<pubDate>Fri, 29 Jan 2010 13:58:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP]]></category>

		<guid isPermaLink="false">http://www.allfreetech.com/?p=151</guid>
		<description><![CDATA[In this article, the author discusses the client-centric approach for AJAX using the ASP.NET AJAX Toolkit. In general, server-centric (use of Update panel) is very popular in this field. But when it comes to performance, the client-centric approach is preferred. Sandeep also demonstrates how to call a webservice using javascript. &#160; Introduction &#160; Today everything [...]]]></description>
			<content:encoded><![CDATA[<p><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Verdana, sans-serif; font-size: 13px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; ">In this article, the author discusses the client-centric approach for AJAX using the ASP.NET AJAX Toolkit. In general, server-centric (use of Update panel) is very popular in this field. But when it comes to performance, the client-centric approach is preferred. Sandeep also demonstrates how to call a webservice using javascript.<span id="more-151"></span></span></p>
<p>&nbsp;</p>
<table class="articleViewer" style="width: 670px; position: relative; top: -21px; ">
<tbody>
<tr>
<td class="subtitle" colspan="2" style="text-align: left; vertical-align: top; color: rgb(204, 0, 0); font-size: 11px; font-weight: bolder; "><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Verdana, sans-serif; font-size: 13px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><span id="intellitTxt"><a class="pageTitle" id="#Page1" style="color: rgb(204, 0, 0); font-size: medium; font-weight: bolder; ">Introduction</a></span></span></td>
</tr>
<tr>
<td class="content" colspan="2" style="text-align: left; vertical-align: top; ">
<div class="backToTop" style="font-size: 11px; ">&nbsp;</div>
<div class="backToTop" style="font-size: 11px; "><span class="Apple-style-span" style="font-size: 13px; ">Today everything is changing very rapidly and technology is of no exception. Traditional web page with boring look and feel has gone obsolete. In that rhythm requirements are also changing. Among all these changes AJAX has become very popular now a days. And why not, it is so attractive and beautiful that everybody would love to have it on their web pages. It saves time for end user, saves resources for server and after all gives a new look and new experience for web browsing.</span></div>
</td>
</tr>
<tr>
<td class="subtitle" colspan="2" style="text-align: left; vertical-align: top; color: rgb(204, 0, 0); font-size: 11px; font-weight: bolder; "><span id="intellitTxt"><a class="pageTitle" id="#Page2" style="color: rgb(204, 0, 0); font-size: medium; font-weight: bolder; ">System Requirements</a></span></td>
</tr>
<tr>
<td class="content" colspan="2" style="text-align: left; vertical-align: top; ">
<div class="backToTop" style="font-size: 11px; "><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 13px;"><font class="Apple-style-span" size="3"><span class="Apple-style-span" style="font-size: 11px;"><br />
					</span></font></span></font></div>
<div class="KonaBody">
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>Microsoft Windows XP Professional</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>VS 2005</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>AJAXToolkit 1.0</p>
</p></div>
</td>
</tr>
<tr>
<td class="subtitle" colspan="2" style="text-align: left; vertical-align: top; color: rgb(204, 0, 0); font-size: 11px; font-weight: bolder; "><span id="intellitTxt"><a class="pageTitle" id="#Page3" style="color: rgb(204, 0, 0); font-size: medium; font-weight: bolder; ">Server Centric Vs Client Centric</a></span></td>
</tr>
<tr>
<td class="content" colspan="2" style="text-align: left; vertical-align: top; ">
<div class="backToTop" style="font-size: 11px; ">&nbsp;</div>
<p></p>
<div class="KonaBody">
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Server Centric</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; text-align: justify; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; There are two ways of AJAX that can be implemented using AJAXToolkit. One is the most popular method, Server Centric (using Update panel) and another one is Client Centric. There are several reasons (given below) why the server centric became so much popular.</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>Server centric takes very less time to implement.</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>From a developer point of view, it is very easy to implement. Just put your controls inside an UpdatePanel and ScriptManager will do rest of the job.</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>It keeps the developer free from JavaScript and developer can concentrate only on server side.</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>Requires less effort.</p>
<p class="MsoBodyTextIndent">But everything in this world comes with a cost. There are also several drawbacks that come along with this approach.</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>Though it does not show but internally it completes the whole page life cycle once again, which actually violates the basics of AJAX. But for an end user it never matters.</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>As it completes the total page life cycle again and hence for better performance client centric is having an edge.</p>
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Client Centric</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>This is the most preferred approach for better performance.</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>It is completely in adherence to the rules of AJAX.</p>
<p class="MsoListBullet" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-indent: -0.25in; font-size: 10pt; font-family: Verdana; "><span style="font-family: Symbol; ">&middot;<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>Though its time taking to implement, but its worthy to spent time on it.</p>
</p></div>
</td>
</tr>
<tr>
<td class="subtitle" colspan="2" style="text-align: left; vertical-align: top; color: rgb(204, 0, 0); font-size: 11px; font-weight: bolder; "><span id="intellitTxt"><a class="pageTitle" id="#Page4" style="color: rgb(204, 0, 0); font-size: medium; font-weight: bolder; ">How to accomplish Client Centric &ndash; Example</a></span></td>
</tr>
<tr>
<td class="content" colspan="2" style="text-align: left; vertical-align: top; ">
<div class="backToTop" style="font-size: 11px; ">&nbsp;</div>
<p></p>
<div class="KonaBody">
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">Lets move step by step to get a complete hold on this.</p>
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Create an AJAX enabled website</p>
<p class="MsoBodyText">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create an AJAX Enabled web site for this example. Ajax enabled website is same as normal .net website but having few more additional tags in web.config.</p>
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Add Webservice and Javascript</p>
<p class="MsoBodyText">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add a webservice (MyService.asmx) to the project. Also add a JS file (Jscript.js) to do the client side activities. Basically we are going to call the Webmethods present in the websevice through java script.</p>
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Add ScriptManager</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Add a ScriptManager to the MasterPage with tags as shown below.</p>
<p class="CodeListingHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; font-weight: bold; text-decoration: underline; ">Listing 1</p>
<div class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">
<pre><span style="color: black; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; "><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&lt;</span><span style="color: maroon; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">asp:ScriptManager</span> <span style="color: red; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">ID</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">=&quot;ScriptManager1&quot;</span>&nbsp;<span style="color: red; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">runat</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">=&quot;server&quot;</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&gt;</span>
<span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&lt;</span><span style="color: maroon; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">Scripts</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&gt;</span>
<span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&lt;</span><span style="color: maroon; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">asp:ScriptReference</span> <span style="color: red; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">Path</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">=&quot;JScript.js&quot;</span> <span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">/&gt;</span>
<span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&lt;/</span><span style="color: maroon; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">Scripts</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&gt;</span>
<span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&lt;</span><span style="color: maroon; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">Services</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&gt;</span>
<span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&lt;</span><span style="color: maroon; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">asp:ServiceReference</span> <span style="color: red; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">Path</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">=&quot;MyService.asmx&quot;</span> <span style="color: red; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">InlineScript</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">=&quot;true&quot;</span> <span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">/&gt;</span>
<span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&lt;/</span><span style="color: maroon; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">Services</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&gt;</span>
<span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&lt;/</span><span style="color: maroon; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">asp:ScriptManager</span><span style="color: blue; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">&gt;</span></span></pre>
</div>
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Do necessary changes to the webservice</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; text-align: justify; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You need to add the&nbsp;<span style="font-family: 'Microsoft Sans Serif', sans-serif; color: teal; ">ScriptService&nbsp;</span>attribute to the webservice class. Then add your own webmethod. Here we have added a GetServerTime() method.</p>
<p class="CodeListingHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; font-weight: bold; text-decoration: underline; ">Listing 2</p>
<div class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">
<pre><span style="color: black; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">[WebMethod]
public&nbsp;string&nbsp;GetServerTime()
{
&nbsp;&nbsp;&nbsp;&nbsp;return DateTime.Now.ToString();
}</span></pre>
</div>
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Test the Webservice, see if it generates the client proxy</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; text-align: justify; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; After this you should be able to test whether your webservice is ready to receive calls from the javascript. Basically the webservice URL followed with &ldquo;/js&rdquo; or &ldquo;/jsdebug&rdquo; will allow you to download the resulting client proxy. This is possible because of the presence of Scriptservice Attribute for Webservice class.</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; text-align: justify; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; text-align: justify; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you will save and open this file, you will find that there will be necessary client proxy entry for each of the webmethods present in webservice.</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; text-align: justify; ">The following prompt ensures that the webservice is correct and ready to use.</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; "><b><u>Figure 1</u></b></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; "><img height="356" src="http://aspalliance.com/ArticleFiles/1909/image001.jpg" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " width="662" /></p>
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Get the result by running the application</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; After this, create a button and run the following javascript function on the button click.</p>
<p class="CodeListingHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; font-weight: bold; text-decoration: underline; ">Listing 3</p>
<div class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">
<pre><span style="color: black; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">//&nbsp;JScript&nbsp;File
function&nbsp;GetTime()
{
&nbsp;&nbsp;&nbsp; MyService.GetServerTime(onSuccess,onFailed);
&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;false;
}</span></pre>
</div>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Here onSuccess and onFailed are the name of the functions (similar to delegates) that will be executed eventually at the success and failure of the AJAX Call. The definitions of them are given below.</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;</p>
<p class="CodeListingHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; font-weight: bold; text-decoration: underline; ">Listing 4</p>
<div class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">
<pre><span style="color: black; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">function&nbsp;onSuccess(result)
{
&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;Current&nbsp;time&nbsp;is:&nbsp;&quot;&nbsp;+ result);
}</span></pre>
</div>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;</p>
<p class="CodeListingHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 0.0001pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; font-weight: bold; text-decoration: underline; ">Listing 5</p>
<div class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">
<pre><span style="color: black; background-color: transparent; font-family: 'Courier New'; font-size: 11px; font-weight: normal; ">function&nbsp;onFailed(result)
{
&nbsp;&nbsp;&nbsp;&nbsp;alert(&quot;Error&nbsp;[&quot;&nbsp;+ result._statusCode&nbsp;+&nbsp;&quot;]&nbsp;:&nbsp;&quot;&nbsp;+&nbsp;result._message);
}</span></pre>
</div>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">Finally it will look like this:</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; "><img height="244" src="http://aspalliance.com/ArticleFiles/1909/image002.jpg" style="border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; " width="392" /></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;</p>
</p></div>
</td>
</tr>
<tr>
<td class="subtitle" colspan="2" style="text-align: left; vertical-align: top; color: rgb(204, 0, 0); font-size: 11px; font-weight: bolder; "><span id="intellitTxt"><a class="pageTitle" id="#Page5" style="color: rgb(204, 0, 0); font-size: medium; font-weight: bolder; ">Similarities with PageMethods</a></span></td>
</tr>
<tr>
<td class="content" colspan="2" style="text-align: left; vertical-align: top; ">
<div class="backToTop" style="font-size: 11px; ">&nbsp;</div>
<p></p>
<div class="KonaBody">
<p class="MsoBodyText">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This is almost similar to the PageMethods concept. In PageMethods there is no need to create a web service for AJAX functionality. Rather your javascript can directly call a method (should be marked as [WebMethod]) present on the code behind file of a .aspx page.</p>
</p></div>
</td>
</tr>
<tr>
<td class="subtitle" colspan="2" style="text-align: left; vertical-align: top; color: rgb(204, 0, 0); font-size: 11px; font-weight: bolder; "><span id="intellitTxt"><a class="pageTitle" id="#Page6" style="color: rgb(204, 0, 0); font-size: medium; font-weight: bolder; ">Differences with IcallbackEventHandler</a></span></td>
</tr>
<tr>
<td class="content" colspan="2" style="text-align: left; vertical-align: top; ">
<div class="backToTop" style="font-size: 11px; ">&nbsp;</div>
<p></p>
<div class="KonaBody">
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; text-align: justify; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It can be said that Client centric approach might have evolved from the<span style="font-family: 'Courier New'; ">ICallbackEventHandler</span>, but actually it is much ahead of&nbsp;<span style="font-family: 'Courier New'; ">ICallbackEventHandler.</span>&nbsp;Few differences are given below:</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-align: justify; text-indent: -0.25in; "><b>1.<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;</span></b>In ICallbackEventHandler, only string types can be supplied to the server as argument. And only string types can be received from server. But in client centric approach&nbsp;<b>the parameter types and number of parameters are of no constraint</b>.&nbsp;<b>One can supply n number of parameters to the server and these can be of anytype.</b></p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-align: justify; text-indent: -0.25in; ">2.<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;</span>ICallbackEventHandler was never Jserialisable. But through this newer approach Jserialization is possible.&nbsp;<b>As a result of which a server can return a datatable, dataset and your Javascript is now capable enough to receive them</b>. (Yes, it was never ever possible in ICallbackEventHandler).</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0.25in; text-align: justify; text-indent: -0.25in; ">3.<span style="font: normal normal normal 7pt/normal 'Times New Roman'; ">&nbsp;&nbsp;&nbsp;&nbsp;</span>One more magic, now using Jserialization of Client Centric,&nbsp;<b>you can create objects of your server side classes at client side</b>. It may not sound so interesting, but if you start thinking, it was also never possible to create an instance of a class in your javascript. But now this is also very much possible.</p>
</p></div>
</td>
</tr>
<tr>
<td class="subtitle" colspan="2" style="text-align: left; vertical-align: top; color: rgb(204, 0, 0); font-size: 11px; font-weight: bolder; "><span id="intellitTxt"><a class="pageTitle" id="#Page7" style="color: rgb(204, 0, 0); font-size: medium; font-weight: bolder; ">Conclusion</a></span></td>
</tr>
<tr>
<td class="content" colspan="2" style="text-align: left; vertical-align: top; ">
<div class="backToTop" style="font-size: 11px; "><span class="Apple-style-span" style="font-size: 13px; ">By now one must have realized that why AJAX is so popular and why client centric approach is advisable. It brought a new era to the world of AJAX. AJAX programming has never been so interesting till date. I remember few years back in the age of manual AJAX, developers used to have a headache for such things, which is now very much doable in seconds using Client Centric approach of AJAX Toolkit. And think of the widely opened possibilities. Yes, we all have to agree that the new era of web development has stepped in and a long way to go.</span></div>
<div class="KonaBody">
<p class="SectionHeading" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; font-size: 10pt; font-family: Verdana, sans-serif; color: rgb(206, 0, 0); font-weight: bold; ">Download</p>
<p class="MsoNormal" style="margin-top: 0in; margin-right: 0in; margin-bottom: 6pt; margin-left: 0in; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link:&nbsp;<a href="http://authors.aspalliance.com/Sacharya/AJAXEnabledWebSite1.zip" style="color: rgb(144, 11, 9); background-color: transparent; ">http://authors.aspalliance.com/Sacharya/AJAXEnabledWebSite1.zip</a></p>
</p></div>
</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.allfreetech.com/ajax/client-centric-approach-of-ajax-using-toolkit-151.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understanding of Latest Web Based Technology: Asp. Net</title>
		<link>http://www.allfreetech.com/microsoft-net/asp-net/understanding-of-latest-web-based-technology-asp-net-167.html</link>
		<comments>http://www.allfreetech.com/microsoft-net/asp-net/understanding-of-latest-web-based-technology-asp-net-167.html#comments</comments>
		<pubDate>Sat, 18 Jul 2009 09:34:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[Based]]></category>
		<category><![CDATA[Latest]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Understanding]]></category>

		<guid isPermaLink="false">http://www.allfreetech.com/?p=167</guid>
		<description><![CDATA[ASP.NET is the latest web based technology in web development and design field. It is also simple and easy to use for user and programmer to code it. .NET is providing one type of platform which supports different web application to execute and run it. ASP means active server pages it will generate HTML and [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET is the latest web based technology in web development and design field. It is also simple and easy to use for user and programmer to code it. .NET is providing one type of platform which supports different web application to execute and run it. ASP means active server pages it will generate HTML and dynamic web pages.</p>
<p>	ASP based web application development is in different languages then making of web application like C# and VB script Language. C# means C Sharp which is Object Oriented Programming Language. ASP uses server side scripting to produce web pages dynamically. Web pages developed in ASP.net technology will not affected by the type of browser the website visitor is using.</p>
<p>	The default scripting language used for writing ASP is VBScript, although you can use other scripting languages like Jscript means JavaScript.</p>
<p>	ASP pages have the extension .asp instead of .htm, when a page with the extension .asp is requested by a browser the web server knows to interpret any ASP contained within the web page before sending the HTML produced to the browser. This way all the ASP is run on the web server and no ASP will ever be passed to the web browser.</p>
<p>	Any web pages containing ASP cannot be run by just simply opening the page in a web browser. The page must be requested through a web server that supports ASP, this is why ASP stands for Active Server Pages, no server, no active pages.</p>
<p>	Web Site Software provides detailed information on Website Software, Free Website Software, Website Content Management Software, Website Design Software and more. Web Site Software is affiliated with Free Shopping Cart Software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.allfreetech.com/microsoft-net/asp-net/understanding-of-latest-web-based-technology-asp-net-167.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

