<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Running specific JavaScript after partial postback</title>
	<atom:link href="http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/feed/" rel="self" type="application/rss+xml" />
	<link>http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/</link>
	<description>Sweetness Without Context</description>
	<lastBuildDate>Wed, 10 Mar 2010 22:45:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: mark</title>
		<link>http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/comment-page-1/#comment-7889</link>
		<dc:creator>mark</dc:creator>
		<pubDate>Thu, 21 Jan 2010 14:35:14 +0000</pubDate>
		<guid isPermaLink="false">http://fooberry.com/?p=764#comment-7889</guid>
		<description>@paul Good news! Firebug should be able to point that type of stuff out pretty quickly.</description>
		<content:encoded><![CDATA[<p>@paul Good news! Firebug should be able to point that type of stuff out pretty quickly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paul</title>
		<link>http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/comment-page-1/#comment-7888</link>
		<dc:creator>paul</dc:creator>
		<pubDate>Thu, 21 Jan 2010 12:24:06 +0000</pubDate>
		<guid isPermaLink="false">http://fooberry.com/?p=764#comment-7888</guid>
		<description>Got this working in a server control now. Ajusted the JQuery selector but wasnt the issue. My issue was that in my test app (as apposed to my main app) my server control was not inside an update panel. Hence the add_endRequest function was not able to execute. Figured it out eveutually.

Thanks a lot.</description>
		<content:encoded><![CDATA[<p>Got this working in a server control now. Ajusted the JQuery selector but wasnt the issue. My issue was that in my test app (as apposed to my main app) my server control was not inside an update panel. Hence the add_endRequest function was not able to execute. Figured it out eveutually.</p>
<p>Thanks a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paul</title>
		<link>http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/comment-page-1/#comment-7877</link>
		<dc:creator>paul</dc:creator>
		<pubDate>Wed, 20 Jan 2010 17:34:49 +0000</pubDate>
		<guid isPermaLink="false">http://fooberry.com/?p=764#comment-7877</guid>
		<description>Ok thanks, while waiting for a reply. I just figured out what they were. Not really used jQuery before. But now understand the basics. 

Thanks a lot. Will give it a go and let you know if i get it working.</description>
		<content:encoded><![CDATA[<p>Ok thanks, while waiting for a reply. I just figured out what they were. Not really used jQuery before. But now understand the basics. </p>
<p>Thanks a lot. Will give it a go and let you know if i get it working.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mark</title>
		<link>http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/comment-page-1/#comment-7876</link>
		<dc:creator>mark</dc:creator>
		<pubDate>Wed, 20 Jan 2010 16:43:12 +0000</pubDate>
		<guid isPermaLink="false">http://fooberry.com/?p=764#comment-7876</guid>
		<description>@paul That is a jQuery selector that finds all elements that have an attribute &#039;id&#039; that ends with &#039;_DoAfterPostbackJavaScriptHiddenField&#039;. See http://docs.jquery.com/Selectors for some more details. It might need to change if the generated ID of the hidden field is different now that it&#039;s in a server control.  

jQuery selectors are tricky at first, but once you get the hang of it, they start making more sense.</description>
		<content:encoded><![CDATA[<p>@paul That is a jQuery selector that finds all elements that have an attribute &#8216;id&#8217; that ends with &#8216;_DoAfterPostbackJavaScriptHiddenField&#8217;. See <a href="http://docs.jquery.com/Selectors" rel="nofollow">http://docs.jquery.com/Selectors</a> for some more details. It might need to change if the generated ID of the hidden field is different now that it&#8217;s in a server control.  </p>
<p>jQuery selectors are tricky at first, but once you get the hang of it, they start making more sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paul</title>
		<link>http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/comment-page-1/#comment-7875</link>
		<dc:creator>paul</dc:creator>
		<pubDate>Wed, 20 Jan 2010 16:36:43 +0000</pubDate>
		<guid isPermaLink="false">http://fooberry.com/?p=764#comment-7875</guid>
		<description>This solution worked great for me in this simple example. Solved my issue thanks!

However I converted it to a ASP.NET server control so I can use it in many places and have placed inside a control library and now think that part of the script needs changing.

The line in the Page_Load event:

$(&#039;[id$=_DoAfterPostbackJavaScriptHiddenField]&#039;).each(doPostbackJS); 

I&#039;m not 100% sure what the [id$=_DoAfterPostbackJavaScriptHiddenField] does. Im guessing its extracting the correct hiddenfield by its id. But what does id$=_ mean exactly or if this is use in conjunction with jquery (which is included and working in the sample youve shown. 

Help appriciated. Thanks</description>
		<content:encoded><![CDATA[<p>This solution worked great for me in this simple example. Solved my issue thanks!</p>
<p>However I converted it to a ASP.NET server control so I can use it in many places and have placed inside a control library and now think that part of the script needs changing.</p>
<p>The line in the Page_Load event:</p>
<p>$(&#8216;[id$=_DoAfterPostbackJavaScriptHiddenField]&#8216;).each(doPostbackJS); </p>
<p>I&#8217;m not 100% sure what the [id$=_DoAfterPostbackJavaScriptHiddenField] does. Im guessing its extracting the correct hiddenfield by its id. But what does id$=_ mean exactly or if this is use in conjunction with jquery (which is included and working in the sample youve shown. </p>
<p>Help appriciated. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mark</title>
		<link>http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/comment-page-1/#comment-4537</link>
		<dc:creator>mark</dc:creator>
		<pubDate>Thu, 02 Jul 2009 16:02:31 +0000</pubDate>
		<guid isPermaLink="false">http://fooberry.com/?p=764#comment-4537</guid>
		<description>@Daryl I&#039;m glad it was useful. I would consider putting that JavaScript in a function that remains client side, then only create the invocation of that function dynamically. You could even get really fancy and do a count down timer on the button, similar to installing FireFox plugins; &quot;Saved (2)&quot;, &quot;Saved (1)&quot;, &quot;Foo Button&quot;.</description>
		<content:encoded><![CDATA[<p>@Daryl I&#8217;m glad it was useful. I would consider putting that JavaScript in a function that remains client side, then only create the invocation of that function dynamically. You could even get really fancy and do a count down timer on the button, similar to installing FireFox plugins; &#8220;Saved (2)&#8221;, &#8220;Saved (1)&#8221;, &#8220;Foo Button&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daryl</title>
		<link>http://fooberry.com/2009/05/25/running-specific-javascript-after-partial-postback/comment-page-1/#comment-4536</link>
		<dc:creator>Daryl</dc:creator>
		<pubDate>Thu, 02 Jul 2009 15:41:25 +0000</pubDate>
		<guid isPermaLink="false">http://fooberry.com/?p=764#comment-4536</guid>
		<description>Thanks for the post.  This was exactly what I needed.  Because I think a rather useful application of this code would be to set a save button&#039;s text to save, and then back to whatever it was before, I created a function to return the javascript needed and thought I&#039;d post it here.

Thanks!

    /// 
    /// Used to change the text of a button to saved, and then back to whatever it was before a few seconds later
    /// 
    /// 
    /// 
    public string GetUpdateSavedButtonJavaScript(string buttonClientId)
    {
        return string.Format(@&quot;
                var saveButton = $(&#039;[id$={0}]&#039;);
                var saveTxtValue = saveButton.attr(&#039;value&#039;);
                saveButton.attr(&#039;value&#039;,&#039;Saved!&#039;)
                setTimeout(function() {{ saveButton.attr(&#039;value&#039;,saveTxtValue) }}, 2000);&quot;, buttonClientId);
    }</description>
		<content:encoded><![CDATA[<p>Thanks for the post.  This was exactly what I needed.  Because I think a rather useful application of this code would be to set a save button&#8217;s text to save, and then back to whatever it was before, I created a function to return the javascript needed and thought I&#8217;d post it here.</p>
<p>Thanks!</p>
<p>    ///<br />
    /// Used to change the text of a button to saved, and then back to whatever it was before a few seconds later<br />
    ///<br />
    ///<br />
    ///<br />
    public string GetUpdateSavedButtonJavaScript(string buttonClientId)<br />
    {<br />
        return string.Format(@&#8221;<br />
                var saveButton = $(&#8216;[id$={0}]&#8216;);<br />
                var saveTxtValue = saveButton.attr(&#8216;value&#8217;);<br />
                saveButton.attr(&#8216;value&#8217;,'Saved!&#8217;)<br />
                setTimeout(function() {{ saveButton.attr(&#8216;value&#8217;,saveTxtValue) }}, 2000);&#8221;, buttonClientId);<br />
    }</p>
]]></content:encoded>
	</item>
</channel>
</rss>
