<?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>Codepolice.net &#187; webforms</title>
	<atom:link href="http://codepolice.net/tag/webforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://codepolice.net</link>
	<description>C#, ASP.NET, MVC, LINQ, Wordpress and stuff like that</description>
	<lastBuildDate>Mon, 26 Jul 2010 08:58:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ASP.NET postback via JQuery / Javascript</title>
		<link>http://codepolice.net/2009/10/14/asp-net-postback-via-jquery-javascript/</link>
		<comments>http://codepolice.net/2009/10/14/asp-net-postback-via-jquery-javascript/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 11:35:04 +0000</pubDate>
		<dc:creator>Ola</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[webforms]]></category>

		<guid isPermaLink="false">http://codepolice.net/?p=172</guid>
		<description><![CDATA[ASP.NET Webforms isn&#8217;t the best platform to build web applications. I can&#8217;t wait to migrate my apps to ASP.NET MVC but until i have the time to do that i have to coup with some of asp.net strange parts. Today i wanted to invoke a postback via JQuery wich actually was fairly easy but i [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET Webforms isn&#8217;t the best platform to build web applications. I can&#8217;t wait to migrate my apps to ASP.NET MVC but until i have the time to do that i have to coup with some of asp.net strange parts.</p>
<p>Today i wanted to invoke a postback via JQuery wich actually was fairly easy but i wanted to write a small post about it.</p>
<p>The trick was to get the Javascript that asp.net call to do a postback, save it somewhere and then executed via the eval() method. I used a hidden form to store the postback script.</p>
<p><strong>In the asp.net file</strong></p>
<div class="codecolorer-container csharp twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hdnSearchPostBack<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span> <span style="color: #008000;">=</span> Page<span style="color: #008000;">.</span><span style="color: #0000FF;">ClientScript</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetPostBackEventReference</span><span style="color: #008000;">&#40;</span>SearchButton, <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p><strong>In the js file</strong></p>
<div class="codecolorer-container csharp twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">function<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> eval<span style="color: #008000;">&#40;</span>$<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;#ctl00_ctl00_hdnSearchPostBack&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">val</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span></div></div>
<p>Simple as that!</p>
]]></content:encoded>
			<wfw:commentRss>http://codepolice.net/2009/10/14/asp-net-postback-via-jquery-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->