<?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>I Learnt Today... &#187; AutoPostBack property</title>
	<atom:link href="http://www.ilearnttoday.com/category/autopostback-property/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ilearnttoday.com</link>
	<description>This is where I share what I learn day by day...</description>
	<lastBuildDate>Fri, 18 May 2012 13:36:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>ASP.NET &#8211; AutoPostBack : What is AutoPostBack and How AutoPostBack Works</title>
		<link>http://www.ilearnttoday.com/c-aspnet-autopostback-how-to-fire-events-for-check-boxes-at-server-side</link>
		<comments>http://www.ilearnttoday.com/c-aspnet-autopostback-how-to-fire-events-for-check-boxes-at-server-side#comments</comments>
		<pubDate>Fri, 26 Dec 2008 10:09:28 +0000</pubDate>
		<dc:creator>Menol</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[AutoPostBack property]]></category>
		<category><![CDATA[C#.NET]]></category>
		<category><![CDATA[Information Technology]]></category>
		<category><![CDATA[Menol]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[.Net framework]]></category>
		<category><![CDATA[AutoPostBack]]></category>
		<category><![CDATA[AutoPostBack Example]]></category>
		<category><![CDATA[can't fire events]]></category>
		<category><![CDATA[checkbox]]></category>
		<category><![CDATA[checkbox control]]></category>
		<category><![CDATA[CheckedChanged]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[define __EVENTTARGET]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[event is not fired]]></category>
		<category><![CDATA[event not executed]]></category>
		<category><![CDATA[event not fired]]></category>
		<category><![CDATA[eventArgument)]]></category>
		<category><![CDATA[events are not fired]]></category>
		<category><![CDATA[events queued to the server]]></category>
		<category><![CDATA[execute event]]></category>
		<category><![CDATA[fire]]></category>
		<category><![CDATA[How AutoPostBack works]]></category>
		<category><![CDATA[how to use __doPostBack]]></category>
		<category><![CDATA[how __doPostBack]]></category>
		<category><![CDATA[how __EVENTARGUMENT works]]></category>
		<category><![CDATA[how __EVENTTARGET works]]></category>
		<category><![CDATA[OnChange]]></category>
		<category><![CDATA[OnChange client side event]]></category>
		<category><![CDATA[OnChange event]]></category>
		<category><![CDATA[postback]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[server side]]></category>
		<category><![CDATA[set AutoPostBack property]]></category>
		<category><![CDATA[The Use of AutoPostBack]]></category>
		<category><![CDATA[use of __EVENTARGUMENT]]></category>
		<category><![CDATA[use of __EVENTTARGET]]></category>
		<category><![CDATA[web control]]></category>
		<category><![CDATA[What is AutoPostBack]]></category>
		<category><![CDATA[what is __doPostBack]]></category>
		<category><![CDATA[what is __EVENTARGUMENT]]></category>
		<category><![CDATA[what is __EVENTTARGET]]></category>
		<category><![CDATA[what __doPostBack does]]></category>
		<category><![CDATA[__doPostBack function]]></category>
		<category><![CDATA[__doPostBack(eventTarget]]></category>
		<category><![CDATA[__EVENTARGUMENT]]></category>
		<category><![CDATA[__EVENTTARGET]]></category>

		<guid isPermaLink="false">http://ilearnttoday.wordpress.com/?p=191</guid>
		<description><![CDATA[2008-12-26 Today I was experimenting on a grid view where I was trying to select multiple rows of the grid<a href="http://www.ilearnttoday.com/c-aspnet-autopostback-how-to-fire-events-for-check-boxes-at-server-side" class="searchmore">Read the Rest...</a><div class="clr"></div>]]></description>
			<content:encoded><![CDATA[<p style="text-align:justify;"><span style="color:#c0c0c0;">2008-12-26<br />
</span></p>
<p style="text-align:justify;"><!--[if gte mso 9]&gt;  Normal 0   false false false        MicrosoftInternetExplorer4  &lt;![endif]--><!--[if gte mso 9]&gt;   &lt;![endif]--> Today I was experimenting on a grid view where I was trying to select multiple rows of the grid view using a check box column.</p>
<p style="text-align:justify;">I wrote some code in the <strong>CheckedChanged </strong>of <strong>checkbox </strong>but then I found that the code was not executed when the state of the checkbox is changed.</p>
<p style="text-align:justify;">So I did a little googling and found out about this AutoPostBack property. This property defines whether the control should post back to the server each time when the user interacts with the control. Or, according to this scenario, a post back will fire when the user clicks on the check box or when the <strong>Checked </strong>property is changed.</p>
<p style="text-align:justify;"><strong>AutoPostBack :</strong></p>
<p style="text-align:justify;">This value holds a boolean value (true/false)</p>
<p style="text-align:justify;">If the property is set to true, a post back is sent immediately to the server and no post back is occurred when set to false.</p>
<p style="text-align:justify;">The Use of AutoPostBack:</p>
<p style="text-align:justify;">According to MSDN, <em>for most WebControls, when AutoPostBack is false, only the events from actions that cause a net change in the state of the control are submitted to the server.</em></p>
<p style="text-align:justify;">In other words some events are not queued to the server. For example no event is fired when a user selects a value from a drop down list or when user presses Enter or Tab key after entering a value to a textbox.</p>
<p style="text-align:justify;">If you want such events to be fired then you have to enable autopostback by setting autopostback property to <em>true</em>.</p>
<p style="text-align:justify;"><strong>How AutoPostBack Works :</strong></p>
<p style="text-align:justify;">When AutoPostBack is enabled, the .Net framework automatically injects following additional items into the generated HTML code.</p>
<ol style="text-align:justify;" type="1">
<li class="MsoNormal">Two Hidden variables with      name __EVENTTARGET and __EVENTARGUMENT</li>
<li class="MsoNormal">A Java script method with      name __doPostBack (eventtarget, eventargument)</li>
<li class="MsoNormal">OnChange JavaScript event to      the control</li>
</ol>
<p style="text-align:justify;">What is <strong>__EVENTTARGET</strong> :</p>
<p style="text-align:justify;">__EVENTTARGET tells the server which control wants to fire the event so that the framework can fire the event on that control.</p>
<p style="text-align:justify;">What is <strong>__EVENTARGUMENT</strong> :</p>
<p style="text-align:justify;">__EVENTARGUMENT can be used to provide additional information to the server about the event.</p>
<p style="text-align:justify;">What is <strong>__doPostBack (eventtarget, eventargument) :</strong></p>
<p style="text-align:justify;">Parameters sent to this method holds relevant target and event argument values and this method sets those values into __EVENTTARGET and __EVENTARGUMENT hidden variables so that the server can read those.</p>
<p style="text-align:justify;">Then this method submits the form to the server where the appropriate event will be fired.</p>
<p style="text-align:justify;">What is <strong>OnChange </strong>JavaScript event to the control :</p>
<p style="text-align:justify;">Every control has a client side event called OnChange. When AutoPostBack is enabled for a control the framework sets the handler for this client side event as the __doPostBack method and will pass the name of the control as the first parameter, eventtarget.</p>
<p style="text-align:justify;">Ex/</p>
<p style="text-align:justify;">Following shows how the framework binds the __doPostBack method to the OnChange event.</p>
<p style="text-align:justify;">&lt;input type=&#8221;checkbox&#8221; <strong><em>onclick=</em></strong><em>&#8220;javascript:setTimeout(&#8216;<strong>__doPostBack(&#8216;CheckBox1&#8242;,&#8221;)</strong>&#8216;, 0)&#8221; </em>/&gt;</p>
<p style="text-align:justify;"><span style="color:#008000;">Was this post helpful to you? How can I improve? &#8211; </span><span style="color:#008000;">Your comment is highly appreciated!</span></p>
<p style="text-align:justify;"><span style="color:#c0c0c0;">Cassian Menol Razeek</span></p>
<p><strong>Recommended Books:</strong></p>
<ul>
<li>
<a href="http://www.amazon.com/gp/product/1590598938?ie=UTF8&amp;tag=ileto-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1590598938">Pro ASP.NET 3.5 in C# 2008</a><img src="http://www.assoc-amazon.com/e/ir?t=ileto-20&amp;l=as2&amp;o=1&amp;a=1590598938" width="1" height="1" border="0" alt="" style="border:none!important;margin:0!important;" /></p>
</li>
<li> <a href="http://www.amazon.com/gp/product/B000YJ2OJ2?ie=UTF8&amp;tag=ileto-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=B000YJ2OJ2">Professional ASP.NET 2.0 Special Edition</a><img style="border:none!important;margin:0!important;" src="http://www.assoc-amazon.com/e/ir?t=ileto-20&amp;l=as2&amp;o=1&amp;a=B000YJ2OJ2" border="0" alt="" width="1" height="1" /></li>
<li>
<a href="http://www.amazon.com/gp/product/047018759X?ie=UTF8&amp;tag=ileto-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=047018759X">Beginning ASP.NET 3.5: In C# and VB Languages</a><img src="http://www.assoc-amazon.com/e/ir?t=ileto-20&amp;l=as2&amp;o=1&amp;a=047018759X" width="1" height="1" border="0" alt="" style="border:none!important;margin:0!important;" />
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ilearnttoday.com/c-aspnet-autopostback-how-to-fire-events-for-check-boxes-at-server-side/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

