<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>Onion Blog</title><link>http://pluralsight.com/blogs/fritz/</link><description /><managingEditor>Fritz Onion</managingEditor><dc:language>en-US</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Fritz Onion</dc:creator><title>Optimizing declarative datasource binding within UpdatePanels</title><link>http://pluralsight.com/blogs/fritz/archive/2008/05/16/50969.aspx</link><pubDate>Fri, 16 May 2008 10:35:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/05/16/50969.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50969.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/05/16/50969.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50969.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50969.aspx</trackback:ping><description>&lt;P&gt;If you've been working with UpdatePanels in ASP.NET Ajax, I'm sure you appreciate how simple they make it to add Ajax behavior to almost any ASP.NET page. You can easily isolate portions of your page to update independently using asynchronous callbacks instead of refreshing the entire page with a standard post-back. In order to keep the programming model identical to that of a synchronous post-back page, however, the UpdatePanel-initiated request will run through your server-side page logic in its entirety, which is often doing more than needed to fulfill the request to update only the contents of the UpdatePanel that actually initiated the request (this is assuming you have set UpdateMode='Conditional'). &lt;/P&gt;
&lt;P&gt;If you have every tried to optimize your page logic to perform only the steps necessary to populate the contents of the UpdatePanel that issued the request, you may have run across the alluring attribute &lt;EM&gt;IsInPartialRendering&lt;/EM&gt; available on the UpdatePanel class. Unfortunately this attribute is always &lt;EM&gt;false&lt;/EM&gt; until deep into the rendering code (or so I've been told, I've never actually seen it get set to true myself) even if the UpdatePanel you are querying was the one to initiate the request. However, you can identify which UpdatePanel issued the async postback by querying the ScriptManager's &lt;EM&gt;AsyncPostBackSourceElementID&lt;/EM&gt; property, which tells you the ID of the control that initiated the async postback, from which you can then infer the corresponding UpdatePanel. For example, if you had the following UpdatePanel defined: &lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;UpdatePanel&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="UpdatePanel1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;UpdateMode&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Conditional"&amp;gt; &lt;BR&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;ContentTemplate&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;BR&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Label&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Label1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;Text&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Panel Created" /&amp;gt; &lt;BR&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;Button&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Button1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;Text&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="Refresh Panel 1"/&amp;gt; &lt;BR&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: #a31515"&gt;&amp;nbsp; &lt;FONT color=#0000ff&gt;&amp;lt;&lt;/FONT&gt;ContentTemplate&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt; &lt;BR&gt;&amp;lt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;UpdatePanel&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" size=3&gt;you would know that it issued the async postback if &lt;EM&gt;AsyncPostBackSourceElementID&lt;/EM&gt; of the &lt;EM&gt;ScriptManager&lt;/EM&gt; was set to &lt;EM&gt;Button1&lt;/EM&gt;. You could then implement your Page Load handler to set the text of the label in the panel only if it was a) not an async postback or b) it was an async postback initiated by this particular UpdatePanel: &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; Page_Load(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs&lt;/SPAN&gt; e) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;{ &lt;BR&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!ScriptManager1.IsInAsyncPostBack || &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;ScriptManager1.AsyncPostBackSourceElementID == &lt;SPAN style="COLOR: #a31515"&gt;"Button1"&lt;/SPAN&gt;) &lt;BR&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;{ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: green"&gt;// Refresh panel 1 data &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;Label1.Text = &lt;SPAN style="COLOR: #a31515"&gt;"Panel refreshed at "&lt;/SPAN&gt; + &lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;.Now.ToString(); &lt;BR&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;} &lt;BR&gt;&lt;/SPAN&gt;} &lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" size=3&gt;In this case we're not really saving much in the way of server-side processing, but if we had to query a database or invoke a Web service to populate the label, the savings could add up quickly. Note that if you end up using this technique, you must anticipate &lt;EM&gt;all&lt;/EM&gt; controls that might initiate an async postback from within an UpdatePanel (or those marked as async triggers outside the panel) and test for all of those identifiers. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" size=3&gt;Now, on to the main point of this post &amp;#8211; if you're using declarative data sources (like the SqlDataSource or ObjectDataSource) to populate data-bound controls within an UpdatePanel, you can use this same technique to pre-empt the data source from retrieving data if the async postback was not initiated by one of the controls in the UpdatePanel being updated. The technique I use is to add a handler for the &lt;EM&gt;Selecting&lt;/EM&gt; event of the data source, and if you determine that this data source should not bother retrieving data, set the &lt;EM&gt;Cancel&lt;/EM&gt; property of the &lt;EM&gt;SqlDataSourceSelectingEventArgs&lt;/EM&gt; parameter passed into the handler. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;asp&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;:&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;SqlDataSource&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;ID&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="_authorsDataSource"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="server"&lt;/SPAN&gt; &lt;SPAN style="COLOR: red"&gt;&amp;#8230; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: red"&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OnSelecting&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;="_authorsDataSource_Selecting"&amp;gt; &lt;BR&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Consolas"&gt;&amp;#8230; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: Consolas"&gt;// in code behind &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;protected&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; _authorsDataSource_Selecting(&lt;SPAN style="COLOR: blue"&gt;object&lt;/SPAN&gt; sender, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: #2b91af"&gt;SqlDataSourceSelectingEventArgs&lt;/SPAN&gt; e) &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;{ &lt;BR&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!_getAuthorData) &lt;SPAN style="COLOR: green"&gt;// _getAuthorData populated with t/f based on update panel&lt;/SPAN&gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;e.Cancel = &lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;; &lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Consolas"&gt;} &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Times New Roman" size=3&gt;So there you go, with a little effort you can not only minimize the data flowing from the server to the client with UpdatePanels, but also the amount of work done on the server. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50969.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>Randomizing rows in a DataTable</title><link>http://pluralsight.com/blogs/fritz/archive/2008/04/16/50729.aspx</link><pubDate>Wed, 16 Apr 2008 07:38:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/04/16/50729.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50729.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/04/16/50729.aspx#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50729.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50729.aspx</trackback:ping><description>&lt;p&gt;I've been working on a project recently where I had the need to randomly shuffle all of the rows in a DataTable. I wanted to do it with the DataTable itself instead of in the act of populating the DataTable for a couple of reasons: 1) I wanted to keep the DataTable in memory and shuffle it in place multiple times without going back to the source, and 2) I had multiple sources where data was coming from (SQL and XML) so I preferred to keep the randomization logic in one place. I also didn't want to copy all of the data (even though it was not a large amount) each time I shuffled, so I decided to use a DataView to display the data shuffled each time I needed it.
&lt;/p&gt;&lt;p&gt;Here's the utility function I came up with  - each time you call RandomizeDataTable it will return a newly shuffled DataView of all the data passed in through the DataTable. Note that because I reuse the added column "rndSortId" each time, any DataViews retrieved from previous calls to the method will have the &lt;em&gt;new&lt;/em&gt; shuffle order. You could change this behavior by adding a new column each time with its own unique sort sequence.
&lt;/p&gt;&lt;p&gt;As always, comments/improvements welcome – enjoy!
&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;&lt;span style="color:blue"&gt;public static&lt;/span&gt;
			&lt;span style="color:blue"&gt;class&lt;/span&gt;
			&lt;span style="color:#2b91af"&gt;DataSetUtilities
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;{
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;static&lt;/span&gt;
			&lt;span style="color:#2b91af"&gt;Random&lt;/span&gt; _rand = &lt;span style="color:blue"&gt;new&lt;/span&gt;
			&lt;span style="color:#2b91af"&gt;Random&lt;/span&gt;();   
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;    
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;public&lt;/span&gt;
			&lt;span style="color:blue"&gt;static&lt;/span&gt;
			&lt;span style="color:#2b91af"&gt;DataView&lt;/span&gt; RandomizeDataTable(&lt;span style="color:#2b91af"&gt;DataTable&lt;/span&gt; dt)
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;    {     
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:green"&gt;// Create array of indices and populate with ordinal values
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;int&lt;/span&gt;[] indices = &lt;span style="color:blue"&gt;new&lt;/span&gt;
			&lt;span style="color:blue"&gt;int&lt;/span&gt;[dt.Rows.Count];
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;for&lt;/span&gt; (&lt;span style="color:blue"&gt;int&lt;/span&gt; i = 0; i &amp;lt; indices.Length; i++)
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;            indices[i] = i;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:green"&gt;// Knuth-Fisher-Yates shuffle indices randomly
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;for&lt;/span&gt; (&lt;span style="color:blue"&gt;int&lt;/span&gt; i = indices.Length - 1; i &amp;gt; 0; i--)
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;        {
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;int&lt;/span&gt; n = _rand.Next(i + 1);
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;int&lt;/span&gt; tmp = indices[i];
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;            indices[i] = indices[n];
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;            indices[n] = tmp;            
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;        }
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:green"&gt;// Add new column to data table (if it's not there already)
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:green"&gt;// to store shuffle index
&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;if&lt;/span&gt; (dt.Columns[&lt;span style="color:#a31515"&gt;"rndSortId"&lt;/span&gt;] == &lt;span style="color:blue"&gt;null&lt;/span&gt;)
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;            dt.Columns.Add(&lt;span style="color:blue"&gt;new&lt;/span&gt;
			&lt;span style="color:#2b91af"&gt;DataColumn&lt;/span&gt;(&lt;span style="color:#a31515"&gt;"rndSortId"&lt;/span&gt;, &lt;span style="color:blue"&gt;typeof&lt;/span&gt;(&lt;span style="color:blue"&gt;int&lt;/span&gt;)));
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;int&lt;/span&gt; rndSortColIdx = dt.Columns[&lt;span style="color:#a31515"&gt;"rndSortId"&lt;/span&gt;].Ordinal;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;for&lt;/span&gt; (&lt;span style="color:blue"&gt;int&lt;/span&gt; i = 0; i &amp;lt; dt.Rows.Count; i++)
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;            dt.Rows[i][rndSortColIdx] = indices[i];
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;
 &lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:#2b91af"&gt;DataView&lt;/span&gt; dv = &lt;span style="color:blue"&gt;new&lt;/span&gt;
			&lt;span style="color:#2b91af"&gt;DataView&lt;/span&gt;(dt);
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;        dv.Sort = &lt;span style="color:#a31515"&gt;"rndSortId"&lt;/span&gt;;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;
			&lt;span style="color:blue"&gt;return&lt;/span&gt; dv;
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;    }
&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-family:Consolas; font-size:12pt"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50729.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>Demos for Boston .NET User Group talk on Silverlight 2</title><link>http://pluralsight.com/blogs/fritz/archive/2008/04/09/50694.aspx</link><pubDate>Wed, 09 Apr 2008 20:48:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/04/09/50694.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50694.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/04/09/50694.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50694.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50694.aspx</trackback:ping><description>For the attendees of tonight's user group talk in Waltham, you can grab the demos &lt;a href="http://www.pluralsight.com/fritz/demos/BostonDotNet_FritzOnion_04_2008.zip"&gt;here&lt;/a&gt;. Thanks for coming, and for all the great questions!
&lt;br /&gt;&lt;br /&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50694.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>Speaking on Silverlight at Boston .NET UG</title><link>http://pluralsight.com/blogs/fritz/archive/2008/04/01/50624.aspx</link><pubDate>Tue, 01 Apr 2008 08:32:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/04/01/50624.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50624.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/04/01/50624.aspx#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50624.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50624.aspx</trackback:ping><description>I'll be speaking next Wednesday (April 9, 2008) at the &lt;a href="http://www.bostondotnet.org/"&gt;Boston .NET User Group&lt;/a&gt; meeting in Waltham, MA. I'm going to look at the new control architecture in Silverlight 2 and talk about building reusable components in Silverlight, so if you're in the area, be sure to reserve the night - should be fun!
&lt;br /&gt;&lt;br /&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50624.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>How to print the current row number in an ASP.NET Repeater control</title><link>http://pluralsight.com/blogs/fritz/archive/2008/03/31/50616.aspx</link><pubDate>Mon, 31 Mar 2008 10:34:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/03/31/50616.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50616.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/03/31/50616.aspx#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50616.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50616.aspx</trackback:ping><description>Here's a quick way to print the current row number in a Repeater control (I promised a conference talk attendee to post this recently):
&lt;br /&gt;&lt;br /&gt;
&amp;lt;asp:Repeater ID="rep1" runat="server' DataSourceID="myds"&amp;gt;&lt;br /&gt;
  &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;
    &amp;lt;%#(((RepeaterItem)Container).ItemIndex+1).ToString() %&amp;gt;&lt;br /&gt;
    &amp;lt;-- other data binding expressions here... --&amp;gt;&lt;br /&gt;
  &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;
&amp;lt;/asp:Repeater&amp;gt; &lt;br /&gt;
&lt;br /&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50616.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>Demos for ASP.NET 3.5 new features talk at DevWeek 2008</title><link>http://pluralsight.com/blogs/fritz/archive/2008/03/13/50464.aspx</link><pubDate>Thu, 13 Mar 2008 07:29:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/03/13/50464.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50464.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/03/13/50464.aspx#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50464.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50464.aspx</trackback:ping><description>If you attended my talk today on New Features of ASP.NET 3.5 and Visual Studio 2008 at DevWeek 2008, you can grab the demos &lt;a href="http://www.pluralsight.com/fritz/demos/DevWeek2008AspDotNet35Vs2008Demos.zip"&gt;here&lt;/a&gt;.
&lt;br /&gt;Thanks for coming!&lt;/a&gt;
&lt;br /&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50464.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>Demos for Silverlight Control talk at VBUG March 2008</title><link>http://pluralsight.com/blogs/fritz/archive/2008/03/12/50458.aspx</link><pubDate>Wed, 12 Mar 2008 16:36:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/03/12/50458.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50458.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/03/12/50458.aspx#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50458.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50458.aspx</trackback:ping><description>If you were at the user group meeting in London tonight for VBUG, &lt;a href="http://www.pluralsight.com/fritz/demos/VBUG2008SilverlightControlsTalk.zip"&gt;here&lt;/a&gt; are the demos for the talk. Thanks for coming and for all the great questions!&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50458.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>Demos for Silverlight ASP.NET Control and Silverlight Server Communication talks at DevWeek 2008</title><link>http://pluralsight.com/blogs/fritz/archive/2008/03/12/50455.aspx</link><pubDate>Wed, 12 Mar 2008 07:53:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/03/12/50455.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50455.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/03/12/50455.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50455.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50455.aspx</trackback:ping><description>If you attended my talk (or talks) today on Silverlight ASP.NET Controls and Silverlight Server Communication at DevWeek 2008, you can grab the demos &lt;a href="http://www.pluralsight.com/fritz/demos/DevWeek2008SilverlightAndAspDotNet.zip"&gt;here&lt;/a&gt; and &lt;a href="http://www.pluralsight.com/fritz/demos/DevWeek2008SilverlightServerCommunication.zip"&gt;here&lt;/a&gt; respectively. &lt;br /&gt;Thanks for coming!&lt;/a&gt;
&lt;br /&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50455.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>Demos for ASP.NET Ajax Design talk at DevWeek 2008</title><link>http://pluralsight.com/blogs/fritz/archive/2008/03/11/50417.aspx</link><pubDate>Tue, 11 Mar 2008 07:22:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/03/11/50417.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50417.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/03/11/50417.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50417.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50417.aspx</trackback:ping><description>If you attended my talk today on ASP.NET Ajax Design at DevWeek 2008, you can grab the demos &lt;A href="http://www.pluralsight.com/fritz/demos/DevWeek2008AjaxDesignDemos.zip"&gt;here.&lt;/a&gt; &lt;br /&gt;Thanks for coming!&lt;/a&gt;
&lt;br /&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50417.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Fritz Onion</dc:creator><title>Demos for Day Of Silverlight precon at DevWeek 2008</title><link>http://pluralsight.com/blogs/fritz/archive/2008/03/10/50408.aspx</link><pubDate>Mon, 10 Mar 2008 11:54:00 GMT</pubDate><guid>http://pluralsight.com/blogs/fritz/archive/2008/03/10/50408.aspx</guid><wfw:comment>http://pluralsight.com/blogs/fritz/comments/50408.aspx</wfw:comment><comments>http://pluralsight.com/blogs/fritz/archive/2008/03/10/50408.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://pluralsight.com/blogs/fritz/comments/commentRss/50408.aspx</wfw:commentRss><trackback:ping>http://pluralsight.com/blogs/fritz/services/trackbacks/50408.aspx</trackback:ping><description>Thanks to all who attended today's pre-conference tutorial on Silverlight with myself and Ian Griffiths. You can grab the demos &lt;a href="http://www.pluralsight.com/fritz/demos/DevWeek2008DayOfSilverlightDemos.zip"&gt;here&lt;/a&gt;.
&lt;br /&gt;
Remember to stop by the Pluralsight booth if you were one of the t-shirt winners to collect your prize (and please stop by even if you weren't)!
&lt;br /&gt;&lt;img src ="http://pluralsight.com/blogs/fritz/aggbug/50408.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>