<?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>Brant Burnett&#039;s Development Blog &#187; AJAX</title>
	<atom:link href="http://btburnett.com/category/ajax/feed" rel="self" type="application/rss+xml" />
	<link>http://btburnett.com</link>
	<description></description>
	<lastBuildDate>Tue, 27 Apr 2010 12:48:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>jQuery.themescript 1.1.0 Released</title>
		<link>http://btburnett.com/2010/02/jquery-themescript-1-1-0-released.html</link>
		<comments>http://btburnett.com/2010/02/jquery-themescript-1-1-0-released.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 22:51:39 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://btburnett.com/?p=112</guid>
		<description><![CDATA[Today I&#8217;ve released version 1.1.0 of jQuery.themescript.  This release includes some significant improvements that make it far more functional in the real world. The original design concept was for a web store framework I was working on.  I wanted each store be able to easily change their javascript based themes without making changes to the [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve released version 1.1.0 of jQuery.themescript.  This release includes some significant improvements that make it far more functional in the real world.</p>
<p>The original design concept was for a web store framework I was working on.  I wanted each store be able to easily change their javascript based themes without making changes to the javascript files for the basic theme.  This made for a much easier file based deployment of new versions to each store.  The obvious downside is that you&#8217;re downloading lots of extra javascript, particularly if you&#8217;re turning features back off that were in the basic theme.  This type of functionality is only useful in certain cases, and is never the most efficient system possible with regards to performance and bandwidth, just maintainability.</p>
<p>This new release still maintains that basic functionality, but now I address a more common concern as well, applying themes to AJAX updates.  In order to support this, I&#8217;ve added several new features.</p>
<ul>
<li>$.themescript.exec now accepts a context parameter.  This can be a jQuery object or an HTML DOM element, just like the context to jQuery&#8217;s <a href="http://api.jquery.com/jQuery/">jQuery(selector, [context])</a> selector function.  All registered functions will receive this context as a parameter, and it will be automatically used as the context to selector-based theming to restrict the elements returned.</li>
</ul>
<ul>
<li>themescript is a new function added to jQuery objects which allows you to execute the themescripts against a specific jQuery object.  $(&#8216;#selector&#8217;).themescript() is equivalent to $.themescript.exec( $(&#8216;#selector&#8217;) )</li>
</ul>
<ul>
<li>themescript( url, [data], [callback] ) works just like the jQuery <a href="http://api.jquery.com/load/">load</a> method, except that it will automatically run themescripts against the updated HTML if the request is successful.</li>
</ul>
<p>You can also easily add support for jQuery.themescript to ASP.Net AJAX partial page updates (a.k.a. UpdatePanels).  Just add this script code to your files and the themescripts will be automatically executed against any UpdatePanels which are changed during an asynchronous postback.</p>
<pre class="brush: jscript;">
var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(function(sender, args) {
    var&lt;/span&gt; updated = args.get_panelsUpdated();
    if&lt;/span&gt; (updated &amp;&amp; updated.length) {
        $.themescript.exec($(updated));
    }
});
</pre>
<p>Here are the links where you can access the GitHub repository or download the files:</p>
<p><a href="http://github.com/btburnett3/jquery.themescript">GitHub</a><br />
<a href="http://github.com/btburnett3/jquery.themescript/zipball/1.1.0">Download</a></p>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2010/02/jquery-themescript-1-1-0-released.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery.Net</title>
		<link>http://btburnett.com/2009/05/jquerynet.html</link>
		<comments>http://btburnett.com/2009/05/jquerynet.html#comments</comments>
		<pubDate>Sat, 02 May 2009 14:49:25 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://btburnett.com/?p=68</guid>
		<description><![CDATA[In the last few months, I&#8217;ve discovered jQuery and jQuery UI, which are a pair pretty awesome of open source javascript libraries.  I know, I&#8217;m a little behind the times here, but all I can say is &#8220;Wow&#8221;.  Frankly, using jQuery makes the AJAX library that comes with .NET 3.0/3.5 from Microsoft seem foolish and [...]]]></description>
			<content:encoded><![CDATA[<p>In the last few months, I&#8217;ve discovered<a href="http://jquery.com"> jQuery</a> and <a href="http://ui.jquery.com">jQuery UI</a>, which are a pair pretty awesome of open source javascript libraries.  I know, I&#8217;m a little behind the times here, but all I can say is &#8220;Wow&#8221;.  Frankly, using jQuery makes the AJAX library that comes with .NET 3.0/3.5 from Microsoft seem foolish and clunky.  I&#8217;ve now transitioned away from using Microsoft&#8217;s open source AJAX Control Library, instead choosing to use jQuery.</p>
<p>The only downside of using jQuery with ASP.Net is the lack of integration.  They now include a vsdoc file which helps with Intellisense, but there&#8217;s a long way to go.  For simplicity, I&#8217;m still using Microsoft&#8217;s AJAX code for their page methods and UpdatePanels, and primarily using jQuery for the client side controls and animations.</p>
<p>I&#8217;ve written a library to help with the creation of ASP.Net server controls that utilize jQuery.  I&#8217;m calling it, very creatively, jQuery.Net.  You can access the code and binaries for the library on github, the link&#8217;s below.</p>
<p><a href="http://github.com/btburnett3/jquery.net/tree/master" target="_blank">jQuery.Net Git Repository</a></p>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2009/05/jquerynet.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix To GroupedUpdatePanel</title>
		<link>http://btburnett.com/2008/04/fix-to-groupedupdatepanel.html</link>
		<comments>http://btburnett.com/2008/04/fix-to-groupedupdatepanel.html#comments</comments>
		<pubDate>Mon, 28 Apr 2008 14:59:00 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.btburnett.com/?p=9</guid>
		<description><![CDATA[After further testing, I discovered a bug in my GroupedUpdatePanel. It didn&#8217;t always function correctly when the postback was initiated by a child control with ChildrenAsTriggers set to true. Any UpdatePanels declared after the initiated panel would update, but those before would not. I&#8217;ve corrected this, though it&#8217;s now a bit more complicated. There is [...]]]></description>
			<content:encoded><![CDATA[<div><small>After further testing, I discovered a bug in my GroupedUpdatePanel.  It didn&#8217;t always function correctly when the postback was initiated by a child control with ChildrenAsTriggers set to true.  Any UpdatePanels declared after the initiated panel would update, but those before would not.  I&#8217;ve corrected this, though it&#8217;s now a bit more complicated.  There is an processing module which needs to be added to your web.config file in the  section.  Here&#8217;s the link to the corrected file.</small></p>
<p><small><a href="http://btburnett.com/downloads/GroupedUpdatePanel.zip">GroupedUpdatePanel.zip</a><br />
</small></div>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2008/04/fix-to-groupedupdatepanel.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grouping Update Panels</title>
		<link>http://btburnett.com/2008/04/grouping-update-panels.html</link>
		<comments>http://btburnett.com/2008/04/grouping-update-panels.html#comments</comments>
		<pubDate>Fri, 25 Apr 2008 10:19:00 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.btburnett.com/?p=8</guid>
		<description><![CDATA[Without a doubt, AJAX is one of the most useful web development tools out there. Through AJAX, we finally have a method for developing web pages with robust user interfaces. The most common and simplest method of AJAX development on ASP.NET is to use the UpdatePanel. While the UpdatePanel creates a lot of overhead, it [...]]]></description>
			<content:encoded><![CDATA[<div><small>Without a doubt, AJAX is one of the most useful web development tools out there.  Through AJAX, we finally have a method for developing web pages with robust user interfaces.</small></p>
<p><small>The most common and simplest method of AJAX development on ASP.NET is to use the UpdatePanel.  While the UpdatePanel creates a lot of overhead, it is very simple to implement.  However, sometimes you will have multiple UpdatePanels on a page that relate to each other.  In order to reduce your overhead, you will probably want to set thier UpdateMode to Conditional.  With the Conditional UpdateMode enabled, they will only update under three conditions (note that nested UpdatePanels are a bit more complicated):<small><br />
</small></small></p>
<ol>
<li><small>A child control of the UpdatePanel performs a postback, and ChildrenAsTriggers is true</small></li>
<li><small>The Update method is explicitly called.</small></li>
<li><small>A manually defined trigger is fired.</small></li>
</ol>
<p><small>However, this doesn&#8217;t help with firing the other UpdatePanels on the page that are related.  While you can update the other panels manually using the Update method or triggers, that can potentially be a lot of work and difficult to maintain.</small></p>
<p><small>In order to address this, I&#8217;ve created a simple GroupedUpdatePanel.  It has a GroupName property which is used to group multiple GroupedUpdatePanels together.  If any one UpdatePanel in a group is updated as part of an asynchronous postback, they will all be updated.</small></p>
<p><small>There are two important restrictions to note.  First, you must set UpdateMode to Conditional.  If any one GroupedUpdatePanel in a group is set to Always, they will all update every time.  This is a result of the limitations of inheriting from the UpdatePanel class.  Second, all of the UpdatePanels must be created and on the page at the time the PreRender event occurs.  I&#8217;ve seen some reports on the web of certain situations where this is not the case, though I haven&#8217;t tested for any of it.</small></p>
<p><small>You can download the source for the control here.  Feel free to use it in your own applications.</small></p>
<p><strong>UPDATE: Please see updated version <a href="http://btburnett.com/2008/04/fix-to-groupedupdatepanelfix-to-groupedupdatepanel.html">here</a></strong></div>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2008/04/grouping-update-panels.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using UpdatePanels Inside A Repeater On A Content Page</title>
		<link>http://btburnett.com/2008/03/using-updatepanels-inside-a-repeater-on-a-content-page.html</link>
		<comments>http://btburnett.com/2008/03/using-updatepanels-inside-a-repeater-on-a-content-page.html#comments</comments>
		<pubDate>Thu, 27 Mar 2008 17:46:00 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.btburnett.com/?p=6</guid>
		<description><![CDATA[In my previous post, I described how to use an UpdatePanel that is located inside a Repeater or other data-bound control while maintaining your databinding. In addition to the data-binding challenge, dynamically creating UpdatePanels your page can also pose other complications.Another issue that I&#8217;ve encountered is identifying controls that the AsyncPostBackTrigger on the UpdatePanel refer [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;">In my previous post, I described how to use an <strong>UpdatePanel</strong> that is located inside a <strong>Repeater</strong> or other data-bound control while maintaining your databinding. In addition to the data-binding challenge, dynamically creating <strong>UpdatePanels</strong> your page can also pose other complications.</span><br /><span style="font-size:85%;"></span><br /><span style="font-size:85%;">Another issue that I&#8217;ve encountered is identifying controls that the <strong>AsyncPostBackTrigger</strong> on the <strong>UpdatePanel</strong> refer to if you are using master pages. So long as the control you are trying to trigger on is located in the same <strong>Content</strong> control of the content page, everything works just fine. However, if the <strong>UpdatePanel</strong> is located in one <strong>Content</strong> control while the control that triggers the asynchronous postback is in another <strong>UpdatePanel</strong>, you&#8217;ll get an exception when the page is loaded saying that it couldn&#8217;t find a control with the ID you specified.</span><br /><span style="font-size:85%;"></span><br /><span style="font-size:85%;">I&#8217;ve found various solutions for correcting this problem by dynamically adding the trigger in code, and using the control&#8217;s <strong>UniqueID</strong> to identify it. However, this becomes significantly more complicated when you are dealing with a dynamically added control. The best solution I&#8217;ve found so far is to use <strong>ScriptManager.RegisterAsyncPostBackControl</strong> to register the post back, and manually call <strong>Update</strong> on each <strong>UpdatePanel</strong> to perform the update. Below is the code that I&#8217;ve found fixes the problem.</span></p>
<p><span style=";font-family:courier new;font-size:85%;"  >Partial Public Class _Default</span><br /><span style="margin-left: 2em;font-family:courier new;font-size:85%;"  >Inherits System.Web.UI.Page</span><br /><span style=";font-family:courier new;font-size:85%;"  ></span><br /><span style="margin-left: 2em;font-family:courier new;font-size:85%;"  >Dim DateUpdatePanels AS New List(Of UpdatePanel)</span></p>
<p><span style="margin-left: 2em;font-family:courier new;font-size:85%;"  >Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load</span><br /><span style="margin-left: 4em;font-family:courier new;font-size:85%;"  >ScriptManager.GetCurrent(Me).RegisterAsyncPostBackControl(edtDate)</span><br /><span style="margin-left: 4em;font-family:courier new;font-size:85%;"  >DataBind()</span><br /><span style="margin-left: 2em;font-family:courier new;font-size:85%;"  >End Sub</span></p>
<p><span style="margin-left: 2em;font-family:courier new;font-size:85%;"  >Private Sub Repeater_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater.ItemDataBound</span><br /><span style="margin-left: 4em;font-family:courier new;font-size:85%;"  >Dim pnl As UpdatePanel = e.Item.FindControl(&#8220;upnlShowTimes&#8221;)</span><br /><span style="margin-left: 4em;font-family:courier new;font-size:85%;"  >If Not IsNothing(pnl) Then</span><br /><span style="margin-left: 6em;font-family:courier new;font-size:85%;"  >DateUpdatePanels.Add(pnl)</span><br /><span style="margin-left: 4em;font-family:courier new;font-size:85%;"  >End If</span><br /><span style="margin-left: 2em;font-family:courier new;font-size:85%;"  >End Sub</span></p>
<p><span style="margin-left: 2em;font-family:courier new;font-size:85%;"  >Private Sub edtDate_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles edtDate.TextChanged</span><br /><span style="margin-left: 4em;font-family:courier new;font-size:85%;"  >For Each pnl As UpdatePanel In DateUpdatePanels</span><br /><span style="margin-left: 6em;font-family:courier new;font-size:85%;"  >pnl.Update()</span><br /><span style="margin-left: 4em;font-family:courier new;font-size:85%;"  >Next</span><br /><span style="margin-left: 2em;font-family:courier new;font-size:85%;"  >End Sub</span><br /><span style=";font-family:courier new;font-size:85%;"  ></span><br /><span style=";font-family:courier new;font-size:85%;"  >End Class</span><br /><span style="font-size:85%;"></span><br /><span style="font-size:85%;">Note that if you define your <strong>ScriptManager</strong> on your content page instead of the master page, you can refer to it directly instead of using <strong>ScriptManager.GetCurrent(Me)</strong>. Also, you must be sure to set <strong>UpdateMode</strong> to <strong>Conditional</strong> on each <strong>UpdatePanel</strong>.</span></p>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2008/03/using-updatepanels-inside-a-repeater-on-a-content-page.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using UpdatePanels inside a Repeater</title>
		<link>http://btburnett.com/2008/03/using-updatepanels-inside-a-repeater.html</link>
		<comments>http://btburnett.com/2008/03/using-updatepanels-inside-a-repeater.html#comments</comments>
		<pubDate>Wed, 26 Mar 2008 20:12:00 +0000</pubDate>
		<dc:creator>Brant Burnett</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.btburnett.com/?p=5</guid>
		<description><![CDATA[Sometimes you might find it necessary to place an UpdatePanel control inside the ItemTemplate of a Repeater or other databound control. Normally you would probably just put the UpdatePanel outside of the repeater, but this can cause other problems. First of all, it makes the size of the update much larger. Secondly, I ran into [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size:85%;">Sometimes you might find it necessary to place an UpdatePanel control inside the ItemTemplate of a Repeater or other databound control. Normally you would probably just put the UpdatePanel outside of the repeater, but this can cause other problems. First of all, it makes the size of the update much larger. Secondly, I ran into a situation where I was using the </span><a href="http://www.curvycorners.net/"><span style="font-size:85%;">curvyCorners</span></a><span style="font-size:85%;"> system for rounding the corners of DIVs that were inside my ItemTemplate.</p>
<p>First of all, it was problematic to run the javascript to round the corners again after the AJAX was done. You can do it using the ScriptManager.RegisterStartupScript method, so long as you place the recommended script code directly in the script block, and don&#8217;t use the window.onload event. However, I found that it is VERY slow since it is running on several DIVs.</p>
<p>Therefore, I decided to use individual UpdatePanel controls inside each DIV that update just the data that needs updating. The problem I encountered is that I couldn&#8217;t reference Container.DataItem for my data-binding inside the UpdatePanel like I could when it wasn&#8217;t there.</p>
<p>The workaround I found was to use type-casting, and instead reference CType(Container, IDataItemContainer).DataItem. This fixed the problem without any side effects, at least so far. Each update panel is independently updated, and the rounded corners stay intact on my DIVs.</span><br /><span style="font-size:85%;"></span><br /><span style="font-size:85%;">Note that I didn&#8217;t have any problems using the Eval method, just DataBinder.GetPropertyValue and other DataBinder methods that require that you pass the DataItem as a parameter.</span><br /><span style="font-size:85%;"></span><br /><span style="font-size:85%;"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://btburnett.com/2008/03/using-updatepanels-inside-a-repeater.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
