<?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>Software development &#187; Ajax</title>
	<atom:link href="http://blog.daiweitech.com/category/aspnet/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.daiweitech.com</link>
	<description>Share tech and experience</description>
	<lastBuildDate>Thu, 11 Feb 2010 05:49:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Variety ways to do asp.net ajax</title>
		<link>http://blog.daiweitech.com/2010/02/03/aspnet-ajax-implementation/</link>
		<comments>http://blog.daiweitech.com/2010/02/03/aspnet-ajax-implementation/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 14:04:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Ajax]]></category>

		<guid isPermaLink="false">http://blog.daiweitech.com/?p=7</guid>
		<description><![CDATA[There are variety of ways doing ajax implementation. In this section I am going to talk about how to implement different ways of ajax using asp.net and jquery.]]></description>
			<content:encoded><![CDATA[<div>There are variety of ways doing ajax implementation. In this section I am going to talk about how to implement different ways of ajax using asp.net and jquery.</div>
<div>
<ol>
<li>Update panel</li>
</ol>
<div>In the page view you need to use &#8220;ScriptManager&#8221; and &#8220;UpdatePanel&#8221; server controls.</div>
<div>Code in page view:</div>
<div>
<div>&lt;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&gt;</div>
<div>&lt;asp:ScriptManager ID=&#8221;ScriptManager1&#8243; runat=&#8221;server&#8221;&gt;</div>
<div>&lt;/asp:ScriptManager&gt;</div>
<div>&lt;asp:UpdatePanel ID=&#8221;UpdatePanel1&#8243; runat=&#8221;server&#8221; UpdateMode=&#8221;Conditional&#8221; RenderMode=&#8221;Block&#8221;&gt;</div>
<div>&lt;ContentTemplate&gt;</div>
<div>&lt;asp:Label ID=&#8221;lbDateTime&#8221; runat=&#8221;server&#8221; &gt;&lt;/asp:Label&gt;</div>
<div>&lt;/ContentTemplate&gt;</div>
<div>&lt;Triggers&gt;</div>
<div>&lt;asp:AsyncPostBackTrigger ControlID=&#8221;btShow&#8221; EventName=&#8221;Click&#8221; /&gt;</div>
<div>&lt;/Triggers&gt;</div>
<div>&lt;/asp:UpdatePanel&gt;</div>
<div>&lt;asp:Button ID=&#8221;btShow&#8221; runat=&#8221;server&#8221; Text=&#8221;DateTime&#8221; onclick=&#8221;bt_click&#8221; /&gt;</div>
<div>&lt;/form&gt;</div>
<div>Code behind page:</div>
<div>public partial class _Default : System.Web.UI.Page</div>
<div>{</div>
<div>protected void Page_Load(object sender, EventArgs e)</div>
<div>{</div>
<div>}</div>
<div>protected void bt_click(object sender, EventArgs e)</div>
<div>{</div>
<div>lbDateTime.Text = DateTime.Now.ToShortDateString();</div>
<div>}</div>
<div>}</div>
</div>
</div>
<ol>
<li>Client callback method</li>
</ol>
<div>Code in page view:</div>
<div>&lt;head runat=&#8221;server&#8221;&gt;</div>
<div>&lt;title&gt;Client Callbacks&lt;/title&gt;</div>
<div>&lt;script type=&#8221;text/javascript&#8221;&gt;</div>
<div>function ReceiveServerData(arg, context) {</div>
<div>Message.innerText = &#8220;Date from server: &#8221; + arg;</div>
<div>}</div>
<div>&lt;/script&gt;</div>
<div>&lt;/head&gt;</div>
<div>&lt;body&gt;</div>
<div>&lt;h2&gt;</div>
<div>Client Callbacks Without Postbacks&lt;/h2&gt;</div>
<div>&lt;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&gt;</div>
<div>&lt;input type=&#8221;button&#8221; value=&#8221;Callback&#8221; onclick=&#8221;CallServer(&#8216;1&#8242;, alert(&#8216;Callback sent to Server&#8217;))&#8221; /&gt;</div>
<div>&lt;br /&gt;</div>
<div>&lt;span id=&#8221;Message&#8221;&gt;&lt;/span&gt;</div>
<div>&lt;/form&gt;</div>
<div>&lt;/body&gt;</div>
<div>Code behind page:</div>
<div>protected void Page_Load(object sender, EventArgs e)</div>
<div>{</div>
<div>ClientScriptManager cm = Page.ClientScript;</div>
<div>String cbReference = cm.GetCallbackEventReference(this, &#8220;arg&#8221;,</div>
<div>&#8220;ReceiveServerData&#8221;, &#8220;&#8221;);</div>
<div>String callbackScript = &#8220;function CallServer(arg, context) {&#8221; +</div>
<div>cbReference + &#8220;; }&#8221;;</div>
<div>cm.RegisterClientScriptBlock(this.GetType(),</div>
<div>&#8220;CallServer&#8221;, callbackScript, true);</div>
<div>}</div>
<div>public string GetCallbackResult()</div>
<div>{</div>
<div>// Returns the results of a callback event to the client.</div>
<div>string dateString = DateTime.Now.ToLongDateString();</div>
<div>return dateString;</div>
<div>}</div>
<div>public void RaiseCallbackEvent(String eventArgument)</div>
<div>{</div>
<div>// Processes a callback event on the server using the event</div>
<div>// argument from the client.</div>
<div>string a = &#8220;&#8221;;</div>
<div>}</div>
<div>
<ol>
<li>Calling web method from javascript</li>
<li>Calling web method from javascript using Jquery</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.daiweitech.com/2010/02/03/aspnet-ajax-implementation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
