<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>technical notes</title>
	<atom:link href="http://ngduy.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://ngduy.wordpress.com</link>
	<description>DuyND's technical notes</description>
	<lastBuildDate>Tue, 06 Oct 2009 17:51:33 +0000</lastBuildDate>
	<language>vi</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='ngduy.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>technical notes</title>
		<link>http://ngduy.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://ngduy.wordpress.com/osd.xml" title="technical notes" />
	<atom:link rel='hub' href='http://ngduy.wordpress.com/?pushpress=hub'/>
		<item>
		<title>test</title>
		<link>http://ngduy.wordpress.com/2009/10/06/test-2/</link>
		<comments>http://ngduy.wordpress.com/2009/10/06/test-2/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 17:51:33 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[NET]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/2009/10/06/test-2/</guid>
		<description><![CDATA[test<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=43&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>test</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=43&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2009/10/06/test-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>Test</title>
		<link>http://ngduy.wordpress.com/2009/07/22/test/</link>
		<comments>http://ngduy.wordpress.com/2009/07/22/test/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 06:07:10 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[NET]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/2009/07/22/test/</guid>
		<description><![CDATA[Test<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=42&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Test</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=42&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2009/07/22/test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>Late-init MaskEditExtender or CalendarExtender for speed up loading page.</title>
		<link>http://ngduy.wordpress.com/2008/03/31/late-init-maskeditextender-or-calendarextender-for-speed-up-loading-page/</link>
		<comments>http://ngduy.wordpress.com/2008/03/31/late-init-maskeditextender-or-calendarextender-for-speed-up-loading-page/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 19:33:20 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[webform]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/?p=39</guid>
		<description><![CDATA[When we uses MaskEditExtender or CalendarExtender in a GridView, List or Repeater. Loading time will be very slow, specially after the page loaded, IE (or FF) will be stop responding in a long time. The reason is AjaxControlToolkit init many MaskEditExtenders. To improve loading speed of GridView which contains MaskEditExtenders or CalendarExtenders, Mask and Calendar [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=39&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When we uses MaskEditExtender or CalendarExtender in a GridView, List or Repeater. Loading time will be very slow, specially after the page loaded, IE (or FF) will be stop responding in a long time. The reason is AjaxControlToolkit init many MaskEditExtenders.</p>
<p>To improve loading speed of GridView which contains MaskEditExtenders or CalendarExtenders, Mask and Calendar control will be init only when user focus on control. Follow example as below:</p>
<p>1. Step 1: Create pre-render Mask or Calendar control.</p>
<p>2. Step 2: Create javascript control to create Mask or Calendar.</p>
<p>3. Step 3: Put into control.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ngduy.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ngduy.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=39&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2008/03/31/late-init-maskeditextender-or-calendarextender-for-speed-up-loading-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>.NET 2.0 Cast operator vs. As operator</title>
		<link>http://ngduy.wordpress.com/2008/03/09/net-20-cast-operator-vs-as-operator/</link>
		<comments>http://ngduy.wordpress.com/2008/03/09/net-20-cast-operator-vs-as-operator/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 18:23:22 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[NET]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/?p=38</guid>
		<description><![CDATA[Khi chuyển từ untyped data values từ SQL database vào 1 biến, sẽ có tình huống xảy ra, khi cast từ DBNull sang một kiểu nào đó, ta sẽ bị InvalidCastException. Tuy nhiên, có một cách để gán thoải mái mà không lo lắng gì. Bắt đầu xem ví dụ dưới đây: Có thể dùng [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=38&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Khi chuyển từ untyped data values từ SQL database vào 1 biến, sẽ có tình huống xảy ra, khi cast từ DBNull sang một kiểu nào đó, ta sẽ bị InvalidCastException. Tuy nhiên, có một cách để gán thoải mái mà không lo lắng gì. Bắt đầu xem ví dụ dưới đây:</p>
<div class="csharpcode">
<pre class="brush: csharp;">
object objstr = DBNull.Value;
string str1 = objstr; //Cast throws an Exception
string str2 = objstr as string //No exception thrown and str2 == null
</pre></div>
<p>Có thể dùng <strong>as</strong> để viết code cho gọn như vd dưới:</p>
<div class="csharpcode">
<pre class="brush: csharp;">
if ( objstr == DBNull.Value )
{
    strResult = &quot;Default&quot;;
}
else
{
    strResult = (string)objstr;
}
//Is equivalent to
strResult = objstr as string ?? &quot;Default&quot;;
</pre></div>
<p>Như vậy, <strong>as</strong> operator giống như <strong>cast</strong> operator, nhưng khi gặp null value, <strong>as</strong> sẽ chuyển giá trị thành null chứ không thrown exception như là <strong>cast</strong>.</p>
<p>Tham khảo MSDN C# Programmer&#8217;s Reference tại <a title="http://msdn2.microsoft.com/en-us/library/cscsdfbt(vs.71).aspx" href="http://msdn2.microsoft.com/en-us/library/cscsdfbt%28vs.71%29.aspx" target="_blank">http://msdn2.microsoft.com/en-us/library/cscsdfbt(vs.71).aspx</a> thì được giải thích như sau:</p>
<div class="csharpcode">
<pre class="brush: csharp;">
expression &lt;span class=&quot;kwrd&quot;&gt;as&lt;/span&gt; type&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;rem&quot;&gt;//is equivalent to&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;expression &lt;span class=&quot;kwrd&quot;&gt;is&lt;/span&gt; type ? (type)expression : (type)null
</pre></div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ngduy.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ngduy.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=38&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2008/03/09/net-20-cast-operator-vs-as-operator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>Fix wrong position of CalendarExtender</title>
		<link>http://ngduy.wordpress.com/2008/03/09/fix-wrong-position-of-calendarextender/</link>
		<comments>http://ngduy.wordpress.com/2008/03/09/fix-wrong-position-of-calendarextender/#comments</comments>
		<pubDate>Sun, 09 Mar 2008 17:59:46 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[NET]]></category>
		<category><![CDATA[webform]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/?p=37</guid>
		<description><![CDATA[Khi thêm CalendarExtender vào một số DataBound controls, thì xảy ra hiện tượng calendar hiển thị không đúng, tức là không hiển thị ngay phía dưới của Textbox. Sau đây là cách fix lỗi này: Trang aspx: Sau đó định nghĩa css này trong file stylesheet: Các style ở phía dưới có thể không có [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=37&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Khi thêm CalendarExtender vào một số DataBound controls, thì xảy ra hiện tượng calendar hiển thị không đúng, tức là không hiển thị ngay phía dưới của Textbox. Sau đây là cách fix lỗi này:</p>
<p><font face="Verdana, Arial, Helvetica" size="2">Trang aspx:<br />
</font></p>
<p><pre class="brush: csharp;">
&lt;asp:TextBox ID=&quot;txtStartDate&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;
&lt;asp:ImageButton ID=&quot;imgStartDate&quot; ImageUrl=&quot;../images/calendar.gif&quot; runat=&quot;server&quot; CausesValidation=&quot;False&quot; /&gt;
&lt;ajaxToolkit:CalendarExtender id=&quot;CalendarExtender1&quot; runat=&quot;server&quot; TargetControlID=&quot;txtStartDate&quot; 
PopupButtonID=&quot;imgStartDate&quot; CssClass=&quot;datePicker&quot;&gt;&lt;/ajaxToolkit:CalendarExtender&gt; </pre><br />
Sau đó định nghĩa css này trong file stylesheet:<br />
<pre class="brush: css;">
.datePicker

{
    position:relative;
    left:5px;
}

.datePicker .ajax__calendar_container
{
background-color:White!important;
border:1px solid blue!important;
z-index:50000;
}
.datePicker .ajax__calendar_hover .ajax__calendar_day
{background-color:#edf9ff;border-color:#daf2fc;color:#0066cc!important;}
.datePicker .ajax__calendar_hover .ajax__calendar_month
{background-color:#edf9ff;border-color:#daf2fc;color:#0066cc!important;}
.datePicker .ajax__calendar_hover .ajax__calendar_year
{background-color:#edf9ff;border-color:#daf2fc;color:#0066cc!important;}
.datePicker .ajax__calendar_hover .ajax__calendar_title
{color:#0066cc!important;}
.datePicker .ajax__calendar_hover .ajax__calendar_today
{color:#0066cc!important;}</pre><br />
Các style ở phía dưới có thể không có cũng được. Chủ yếu cho đẹp.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ngduy.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ngduy.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=37&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2008/03/09/fix-wrong-position-of-calendarextender/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>Huỷ biến trong .NET</title>
		<link>http://ngduy.wordpress.com/2007/10/15/hu%e1%bb%b7-bi%e1%ba%bfn-trong-net/</link>
		<comments>http://ngduy.wordpress.com/2007/10/15/hu%e1%bb%b7-bi%e1%ba%bfn-trong-net/#comments</comments>
		<pubDate>Mon, 15 Oct 2007 09:46:53 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[NET]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/2007/10/15/hu%e1%bb%b7-bi%e1%ba%bfn-trong-net/</guid>
		<description><![CDATA[Trong .NET environment, khi một object sẽ bị huỷ, bộ nhớ và resources nó dùng sẽ được thu hồi khi không còn tham chiếu nào đến object đó. Khi dùng một object, biến sẽ giữ một tham chiếu hay con trỏ đến object đó. Ví dụ Dim myPerson As New Person() Nghĩa là biến myPerson [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=36&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal"><span>Trong .NET environment, khi một object sẽ bị huỷ, bộ nhớ và resources nó dùng sẽ được thu hồi khi không còn tham chiếu nào đến object đó.</span></p>
<p class="MsoNormal"><span>Khi dùng một object, biến sẽ giữ một tham chiếu hay con trỏ đến object đó.</span></p>
<p class="MsoNormal"><span>Ví dụ</span></p>
<p class="MsoNormal"><font color="#0000ff"><em>Dim myPerson As New Person()</em></font><span></span></p>
<p class="MsoNormal"><span>Nghĩa là biến myPerson chỉ tham chiếu đến object vừa tạo. Nếu có đoạn code sau:</span></p>
<p class="MsoNormal"><em><font color="#0000ff">Dim anotherPerson As Person<br />
anotherPerson = myPerson</font><span></span></em></p>
<p class="MsoNormal"><span>Nghĩa là biến anotherPerson cũng tham chiếu đến cùng một object. Điều này có nghĩa là object Person thì được tham chiếu bởi 2 biến: myPerson và anotherPerson.</span></p>
<p class="MsoNormal"><span>Khi không còn biến nào tham chiếu đến object, nó sẽ được .NET framework terminated. Cụ thể, nó sẽ được terminated và thu hồi bởi một cơ chế gọi là garbage collection.</span></p>
<p class="MsoNormal"><span>Không giống COM (vd VB6), .NET framework không dùng cách đếm số tham chiếu để quyết định việc có huỷ object đó hay không. Thay vào đó, nó dùng một cơ chế khác để quyết định việc huỷ object đó.</span></p>
<p class="MsoNormal"><span>Điều đó có nghĩa là, trong Visual Basic (hay .NET), ta không cần quyết định việc huỷ object đó, bởi vì không thể quyết định chính xác khi nào object sẽ được huỷ.</span></p>
<p class="MsoNormal"><span>Để chấm dứt tham chiếu đến một object. Ta có thể gỡ tham chiếu một cách cụ thể bằng cách gán Nothing vào biến đó bằng đoạn code sau:</span></p>
<p class="MsoNormal"><font color="#0000ff"><em><span>myPerson = Nothing</span></em></font></p>
<p class="MsoNormal"><span>Ta cũng có thể gỡ bỏ tham chiếu tới một object bằng cách thay đổi tham chiếu của biến tới một object khác. Vì một biến chỉ có thể tham chiếu tới một object tại một thời điểm. Ta có thể code như sau:</span></p>
<p class="MsoNormal"><font color="#0000ff"><em><span>myPerson = New Person()</span></em></font></p>
<p class="MsoNormal"><span>Biến sẽ tham chiếu tới một object mới, vì thế, sẽ release tham chiếu tới object trước đó.</span></p>
<p class="MsoNormal"><span>Đây là ví dụ về explicit dereferencing, VB còn cung cấp một phương pháp thuận tiện hơn để gỡ bỏ tham chiếu đến một object gọi là implicit dereferencing khi biến đó out of scope.</span></p>
<p class="MsoNormal"><span>Ví dụ, nếu ta có một biến được mô tả trong một method, khi method hoàn tất, biến đó sẽ được tự động huỷ, như vậy cũng sẽ huỷ tham chiếu đến những object đã được tham chiếu.</span></p>
<p class="MsoNormal"><span>Tóm lại, Bất cứ lúc nào biến tham chiếu đến một object out of scope, tham chiếu đến object đó sẽ tự động được huỷ. Ví dụ:</span></p>
<p class="MsoNormal"><font color="#0000ff"><em><span>Private Sub DoSomething()<br />
Dim myPerson As Person<br />
myPerson = New Person()<br />
End Sub</span></em></font></p>
<p class="MsoNormal"><span>Cho dù ta không gán giá trị của myPerson là Nothing một cách cụ thể, ta biết rằng biến myPerson sẽ bị huỷ khi method kết thúc, sau khi nó out of scope. Tham chiếu đến Person object được tạo trong hàm sẽ hoàn toàn được gỡ bỏ.</span></p>
<p class="MsoNormal"><span>Dĩ nhiên, sẽ có một kịch bản khác trong đó object sẽ bị huỷ khi ứng dụng hoàn toàn kết thúc. Vào lúc này, tất cả các biến sẽ bị huỷ, và tất cả tham chiếu đến object sẽ hoàn toàn kết thúc.</span></p>
<p> <font color="#808080"><em>(Tham khảo: Wrox.Professional.VB.2005.Nov.2005.pdf &#8211; Chương 4, Trang 115)</em></font></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ngduy.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ngduy.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=36&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2007/10/15/hu%e1%bb%b7-bi%e1%ba%bfn-trong-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Studio 2005 Product comparisons</title>
		<link>http://ngduy.wordpress.com/2007/09/27/visual-studio-2005-product-comparisons/</link>
		<comments>http://ngduy.wordpress.com/2007/09/27/visual-studio-2005-product-comparisons/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 03:01:01 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[Reference]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/2007/09/27/visual-studio-2005-product-comparisons/</guid>
		<description><![CDATA[Xem so sánh các bản VS 2005 tại đây http://msdn2.microsoft.com/en-us/vstudio/aa700921.aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=35&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Xem so sánh các bản VS 2005 tại đây</p>
<p><a href="http://msdn2.microsoft.com/en-us/vstudio/aa700921.aspx" title="http://msdn2.microsoft.com/en-us/vstudio/aa700921.aspx">http://msdn2.microsoft.com/en-us/vstudio/aa700921.aspx</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ngduy.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ngduy.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=35&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2007/09/27/visual-studio-2005-product-comparisons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>Javascript tutorial &amp; examples</title>
		<link>http://ngduy.wordpress.com/2007/09/24/javascript-tutorial-examples/</link>
		<comments>http://ngduy.wordpress.com/2007/09/24/javascript-tutorial-examples/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 04:28:41 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[Reference]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/2007/09/24/javascript-tutorial-examples/</guid>
		<description><![CDATA[Tham khảo javascript toàn tập. Có kèm trình soạn thảo online. http://www.w3schools.com/js/js_examples_3.asp<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=34&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Tham khảo javascript toàn tập. Có kèm trình soạn thảo online.</p>
<p><a href="http://www.w3schools.com/js/js_examples_3.asp" title="http://www.w3schools.com/js/js_examples_3.asp">http://www.w3schools.com/js/js_examples_3.asp</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ngduy.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ngduy.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=34&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2007/09/24/javascript-tutorial-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>Deploy to server using CLickOnce</title>
		<link>http://ngduy.wordpress.com/2007/09/24/deploy-to-server-using-clickonce/</link>
		<comments>http://ngduy.wordpress.com/2007/09/24/deploy-to-server-using-clickonce/#comments</comments>
		<pubDate>Mon, 24 Sep 2007 04:16:27 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[NET]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/2007/09/24/deploy-to-server-using-clickonce/</guid>
		<description><![CDATA[Để deploy application lên server dùng ClickOnce. Server cần có IIS FrontPage 2002 Server Extensions. Tuy nhiên, khi publish lên server, sẽ gặp những vấn đề sau: Error 7 Failed to connect to &#8216;http://server IP/Projects/&#8217; with the following error: Unable to create the Web &#8216;http://server IP/projects/&#8217;. Server error: Error 5 opening registry key &#8220;SOFTWARE\Classes&#8221; =&#62; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=33&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Để deploy application lên server dùng ClickOnce. Server cần có</p>
<ul>
<li><strong>IIS</strong></li>
<li><strong>FrontPage 2002 Server Extensions.</strong></li>
</ul>
<p>Tuy nhiên, khi publish lên server, sẽ gặp những vấn đề sau:</p>
<table border="0" cellpadding="1" cellspacing="1">
<tr>
<td colspan="2"><strong>Error 7 Failed to connect to &#8216;http://server IP/Projects/&#8217; with the following error: Unable to create the Web &#8216;http://server IP/projects/&#8217;. Server error: Error 5 opening registry key &#8220;SOFTWARE\Classes&#8221;</strong></td>
</tr>
<tr>
<td valign="top" width="50"><strong>=&gt;<br />
</strong></td>
<td>Do FrontPage server extensions không có quyền access vào key HKEY_LOCAL_MACHINE\SOFTWARE\Classes.</td>
</tr>
<tr>
<td valign="top"><strong>=&gt;<br />
</strong></td>
<td valign="top">
<ol>
<li>Vào regedit</li>
<li>Nhấn phím phải lên HKEY_LOCAL_MACHINE\SOFTWARE\Classes. Chọn permissions</li>
<li>Add user Everyone (Hiện tại chỉ biết add thế, cụ thể chỉ cần add user nào sẽ tìm hiểu sau)</li>
<li>Check vào allow FullControl cho user Everyone</li>
</ol>
</td>
</tr>
<tr>
<td colspan="2"><strong>Error 7 Failed to connect to &#8216;http://server IP/Projects/&#8217; with the following error: Unable to create the Web &#8216;http://server IP/projects/&#8217;. Server error: Error 5 opening registry key &#8220;SOFTWARE\Classes\.hlp&#8221;</strong></td>
</tr>
<tr>
<td valign="top" width="50"><strong>=&gt;<br />
</strong></td>
<td>Nguyên nhân và cách khắc phục tương tự như trên.</td>
</tr>
</table>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ngduy.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ngduy.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=33&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2007/09/24/deploy-to-server-using-clickonce/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.NET AJAX progress indicator</title>
		<link>http://ngduy.wordpress.com/2007/09/23/aspnet-ajax-progress-indicator/</link>
		<comments>http://ngduy.wordpress.com/2007/09/23/aspnet-ajax-progress-indicator/#comments</comments>
		<pubDate>Sun, 23 Sep 2007 09:10:25 +0000</pubDate>
		<dc:creator>ngduy</dc:creator>
				<category><![CDATA[webform]]></category>

		<guid isPermaLink="false">http://ngduy.wordpress.com/2007/09/23/aspnet-ajax-progress-indicator/</guid>
		<description><![CDATA[Dưới đây là cách làm progress indicator trong asp.net với Atlas (MS Ajax). Khi ấn vào sẽ có 1 cái hình xoay xoay và con trỏ chuột trở thành waiting. Trông cũng hay phết. Bài này là bài sưu tầm. Ghi qua đây để tiện lấy ra khi cần. Source trang aspx Souce code behind [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=32&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Dưới đây là cách làm progress indicator trong asp.net với Atlas (MS Ajax). Khi ấn vào sẽ có 1 cái hình xoay xoay và con trỏ chuột trở thành waiting. Trông cũng hay phết. Bài này là bài sưu tầm. Ghi qua đây để tiện lấy ra khi cần.</p>
<p>Source trang aspx<br />
<pre class="brush: jscript;">
&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="UpdatePanelAnimation" %&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
&lt;head runat="server"&gt;
  &lt;title&gt;Update Panel with Animation&lt;/title&gt;
  &lt;link href="UpdatePanelAnimation.css" rel="stylesheet" type="text/css" /&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
    &lt;asp:ScriptManager ID="ScriptManager1" runat="server" /&gt;
    &lt;div id="Container" class="Normal"&gt;
      &lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&gt;
        &lt;ContentTemplate&gt;
          &lt;asp:Label ID="Label1" runat="server" Text="Update Me" /&gt;&lt;br /&gt;&lt;br /&gt;
          &lt;asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /&gt;
        &lt;/ContentTemplate&gt;
      &lt;/asp:UpdatePanel&gt;
    &lt;/div&gt;
  &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;&lt;/asp&gt;
</pre><br />
Souce code behind c#<br />
<pre class="brush: csharp;">
public partial class UpdatePanelAnimation : System.Web.UI.Page
{
  protected void Button1_Click(object sender, EventArgs e)
  {
    Thread.Sleep(5000);

    Label1.Text = DateTime.Now.ToString();
  }
}
</pre><br />
Souce css<br />
<pre class="brush: css;">
.Normal
{
  border: dashed 1px #000000;
  background-color: #FFFFFF;
  cursor: auto;
  padding: 10px;
  width: 200px;
  text-align: center;
}

.Progress
{
  border: dashed 1px #000000;
  background-color: #EEEEEE;
  background-image: url(spinner.gif);
  background-position: center center;
  background-repeat: no-repeat;
  cursor: wait;
  padding: 10px;
  width: 200px;
  text-align: center;
}
</pre><br />
Cuối cùng là source javascript để handle event<br />
<pre class="brush: jscript;">
&lt;script language="javascript"&gt;
  // Get a reference to the PageRequestManager.
  var prm = Sys.WebForms.PageRequestManager.getInstance();

  // Using that prm reference, hook _initializeRequest
  // and _endRequest, to run our code at the begin and end
  // of any async postbacks that occur.
  prm.add_initializeRequest(InitializeRequest);
  prm.add_endRequest(EndRequest);

  // Executed anytime an async postback occurs.
  function InitializeRequest(sender, args)
  {
    // Change the Container div's CSS class to .Progress.
    $get('Container').className = 'Progress';

    // Get a reference to the element that raised the postback,
    //   and disables it.
    $get(args._postBackElement.id).disabled = true;
  }

  // Executed when the async postback completes.
  function EndRequest(sender, args)
  {
    // Change the Container div's class back to .Normal.
    $get('Container').className = 'Normal';

    // Get a reference to the element that raised the postback
    //   which is completing, and enable it.
    $get(sender._postBackSettings.sourceElement.id).disabled = false;
  }
&lt;/script&gt;
</pre></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/ngduy.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/ngduy.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/ngduy.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/ngduy.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/ngduy.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/ngduy.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/ngduy.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/ngduy.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/ngduy.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/ngduy.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/ngduy.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/ngduy.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/ngduy.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/ngduy.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/ngduy.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/ngduy.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=ngduy.wordpress.com&amp;blog=1225560&amp;post=32&amp;subd=ngduy&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://ngduy.wordpress.com/2007/09/23/aspnet-ajax-progress-indicator/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/42c3bff0fc1cffcc267979ce8800fab5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">ngduy</media:title>
		</media:content>
	</item>
	</channel>
</rss>
