<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DU8GQno6eip7ImA9WhVUEUo.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027</id><updated>2012-05-16T09:17:03.412-05:00</updated><category term="SalesForce.com" /><category term="Microsoft" /><category term="iPad" /><category term="CRM" /><category term="Apple" /><title>Brian Orrell</title><subtitle type="html">Assert.AreEqual(blog.BlogType, BlogType.Development);</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://borrell.parivedasolutions.com/" /><author><name>Brian Orrell</name><uri>http://www.blogger.com/profile/11139586064824268007</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="31" src="http://4.bp.blogspot.com/-9ENCM-_Nat8/T6Ggad4zSZI/AAAAAAAAAF4/nNbeVPT9zzg/s220/Headshot.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/BrianOrrell" /><feedburner:info uri="brianorrell" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;C0EDQX0_cCp7ImA9WhVVF0k.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-8991080159224797929</id><published>2012-05-11T08:07:00.000-05:00</published><updated>2012-05-11T08:07:50.348-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-05-11T08:07:50.348-05:00</app:edited><title>Accepting Diversity - The Mandate of Mobile</title><content type="html">I found this very interesting bit from the &lt;a href="http://blogs.wsj.com/cio/2012/05/10/the-morning-download-the-age-of-mobile-is-upon-us/?mod=wsjcio_hps_cioreport" target="_blank"&gt;Wall Street Journal, CIO Edition&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
Google senior vice president Vic Gundrota used the company’s social network to introduce a mobile version of Google+. The fact Google introduced it for Apple devices first, because the Android version isn’t ready, is an acknowledgement both of the urgency to get a mobile version of its social network into the market, and the primacy of the iPhone.&lt;/blockquote&gt;
This is the way organizations must operate in the new world of multi-platform, multi-OS, and multi-form-factors with no dominant winner. &amp;nbsp;Gone are the days of using your monopoly in one area to force your users to use your other products. &amp;nbsp;If you are selling a service, you must accept the fact that you should actively pursue every avenue to sell that service, &lt;i&gt;even by actively promoting it on your competitors platforms&lt;/i&gt;.&lt;br /&gt;
&lt;br /&gt;
Even Microsoft is beginning to slowly adopt this approach. &amp;nbsp;They have released Lync and OneNote applications for iOS and there are lot of well respected prognosticators who believe there will be more versions of Office applications that will run on competing devices in the future.&lt;br /&gt;
&lt;br /&gt;
Pariveda continues to actively develop mobile strategies and roadmaps for our clients that embrace the diversity of platforms as a current and future reality. &amp;nbsp;Enterprises must be prepared to support multiple platforms and develops applications that effectively run on these platforms.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-8991080159224797929?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/2X10E99Bn68" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/8991080159224797929/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=8991080159224797929" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/8991080159224797929?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/8991080159224797929?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/2X10E99Bn68/accepting-diversity-mandate-of-mobile.html" title="Accepting Diversity - The Mandate of Mobile" /><author><name>Brian Orrell</name><uri>http://www.blogger.com/profile/11139586064824268007</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="31" src="http://4.bp.blogspot.com/-9ENCM-_Nat8/T6Ggad4zSZI/AAAAAAAAAF4/nNbeVPT9zzg/s220/Headshot.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2012/05/accepting-diversity-mandate-of-mobile.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUAFQX07eip7ImA9Wx9VF0k.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-6856520655435318886</id><published>2011-02-03T09:41:00.000-06:00</published><updated>2011-02-03T09:41:50.302-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-03T09:41:50.302-06:00</app:edited><title>PaaS Definition: It Depends On Whom You Ask...</title><content type="html">David Chappell wrote &lt;a href="http://davidchappellopinari.blogspot.com/2011/01/what-is-paas.html"&gt;an interesting post&lt;/a&gt; on what the "real" definition of PaaS (Platform as a Service) is.&lt;br /&gt;
&lt;br /&gt;
As with many emerging technologies, vendors try to cast their offering in the most favorable light by adjusting the definition to match what their product does.&lt;br /&gt;
&lt;br /&gt;
He talks about the four main competitors: Microsoft (Windows Azure), Google (AppEngine), SalesForce (Force.com) and Amazon (Elastic Beanstalk) and how their systems have similar and also widely varying approaches.&lt;br /&gt;
&lt;br /&gt;
The one capability that sticks out for me the most is "updating with no downtime."  That seems like a entry-level requirement and one that surprisingly Amazon's Elastic Beanstalk currently doesn't support.  This is a very new offering for Amazon so I have to imagine that it is on the radar for future enhancements.  "Root Access to the VM" the application is running on seems like more of a selling opportunity to IT buyers concerned about giving up control-- if it works the way PaaS is supposed to, do I really need that level of access? Auto-scaling is another one that I think is a must-have across all of the stacks.  If my demand spikes at 3am, please tell me a human is not required to increase the capacity-- automate please.&lt;br /&gt;
&lt;br /&gt;
The PaaS space is certainly one that we at Pariveda see as the most promising and one that we look forward to discussing further with organizations.  I will be speaking with &lt;a href="http://vaughanmerlyn.com/about-vaughan-merlyn/"&gt;Vaughan Merlyn&lt;/a&gt; in February and early March on the Threats and Opportunities in the Cloud in &lt;a href="http://www.parivedasolutions.com/Pages/2011CIOForum-ThreatsandOpportunitiesintheCloudChicago.aspx"&gt;Chicago&lt;/a&gt;, &lt;a href="http://www.parivedasolutions.com/Pages/2011CIOForum-ThreatsandOpportunitiesintheCloudDallas.aspx"&gt;Dallas&lt;/a&gt;, &lt;a href="http://www.parivedasolutions.com/Pages/2011CIOForum-ThreatsandOpportunitiesintheCloudHouston.aspx"&gt;Houston&lt;/a&gt; and &lt;a href="http://www.parivedasolutions.com/Pages/2011CIOForum-ThreatsandOpportunitiesintheCloudSeattle.aspx"&gt;Seattle&lt;/a&gt;.  If you're near the area during that time, sign up and come see us.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-6856520655435318886?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/yEw0_OOEQFM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/6856520655435318886/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=6856520655435318886" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/6856520655435318886?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/6856520655435318886?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/yEw0_OOEQFM/paas-definition-it-depends-on-whom-you.html" title="PaaS Definition: It Depends On Whom You Ask..." /><author><name>Brian Orrell</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="31" src="http://3.bp.blogspot.com/-7Ryf2QfYu10/T6Ggy9CMHiI/AAAAAAAAAFw/HNenTMg6Al8/s220/Headshot.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2011/02/paas-definition-it-depends-on-whom-you.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QHSX06eyp7ImA9Wx9WF08.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-6409214291178216038</id><published>2011-01-22T12:35:00.000-06:00</published><updated>2011-01-22T12:35:38.313-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-22T12:35:38.313-06:00</app:edited><title>Microsoft to offer Chatter-like OfficeTalk</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_6gFDZzavM88/TTsjNVMZSII/AAAAAAAAADo/f8OAlIIhZPQ/s1600/OfficeTalkCompanyFeed.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"&gt;&lt;img border="0" height="150" width="200" src="http://4.bp.blogspot.com/_6gFDZzavM88/TTsjNVMZSII/AAAAAAAAADo/f8OAlIIhZPQ/s200/OfficeTalkCompanyFeed.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
&lt;a href="http://www.zdnet.com/blog/microsoft/microsoft-moves-its-chatter-like-officetalk-toward-commercialization/8498"&gt;This could be great for Microsoft technologies.&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
I have to say that when I first heard about SalesForce.com's Chatter, I wasn't intrigued.  It sounded like "just another enterprise micro-blogging tool."  When I caught up with a contact who had recently moved over to work for SalesForce, and I got the scoop on what Chatter really is I was incredibly impressed.&lt;br /&gt;
&lt;br /&gt;
The concept of not only being able to follow &lt;i&gt;people&lt;/i&gt; within my company but also &lt;i&gt;things&lt;/i&gt; is very cool.  So any entity that I create on the Force.com platform can participate in my Chatter stream.  That is powerful.  I could follow a client, an opportunity, a project, a team... hopefully if and when Microsoft gets on the micro-blogging bandwagon, they take the same approach to allowing &lt;i&gt;anything&lt;/i&gt; to be followed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-6409214291178216038?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/vH8Wi31--8k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/6409214291178216038/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=6409214291178216038" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/6409214291178216038?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/6409214291178216038?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/vH8Wi31--8k/microsoft-to-offer-chatter-like.html" title="Microsoft to offer Chatter-like OfficeTalk" /><author><name>Brian Orrell</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="31" src="http://3.bp.blogspot.com/-7Ryf2QfYu10/T6Ggy9CMHiI/AAAAAAAAAFw/HNenTMg6Al8/s220/Headshot.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_6gFDZzavM88/TTsjNVMZSII/AAAAAAAAADo/f8OAlIIhZPQ/s72-c/OfficeTalkCompanyFeed.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2011/01/microsoft-to-offer-chatter-like.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0ADQ3c4fCp7ImA9Wx9WE0U.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-7300143929787925850</id><published>2011-01-18T15:47:00.003-06:00</published><updated>2011-01-18T16:29:32.934-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-18T16:29:32.934-06:00</app:edited><title>Microsoft makes OneNote free on the iPhone. Is iPad next?</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_6gFDZzavM88/TTYURhs7ljI/AAAAAAAAADg/PnYhSuzzAS0/s1600/onenotemobileiphone.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"&gt;&lt;img border="0" height="200" width="140" src="http://2.bp.blogspot.com/_6gFDZzavM88/TTYURhs7ljI/AAAAAAAAADg/PnYhSuzzAS0/s200/onenotemobileiphone.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;
Key quote from &lt;a href="http://www.zdnet.com/blog/microsoft/microsoft-makes-onenote-free-on-the-iphone-is-ipad-next/8458"&gt;this piece&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote&gt;Microsoft is a software company. The company should offer software products across platforms to maximize its addressable market. The entire Microsoft Office suit should be made available on the iPad. Otherwise, Numbers, Pages, etc. for iPad will only continue to grow.&lt;/blockquote&gt;&lt;br /&gt;
It's great to see that they are developing more apps for iOS.  As the device space heats up and more non-Windows devices make their way into our lives, Microsoft Office, their cash-cow, must try and be on as many of them as possible.&lt;br /&gt;
&lt;br /&gt;
My gut tells me it won't happen, but I was surprised to see even OneNote.  Baby steps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-7300143929787925850?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/dJcE3-CmA4Q" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/7300143929787925850/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=7300143929787925850" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/7300143929787925850?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/7300143929787925850?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/dJcE3-CmA4Q/microsoft-makes-onenote-free-on-iphone.html" title="Microsoft makes OneNote free on the iPhone. Is iPad next?" /><author><name>Brian Orrell</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="31" src="http://3.bp.blogspot.com/-7Ryf2QfYu10/T6Ggy9CMHiI/AAAAAAAAAFw/HNenTMg6Al8/s220/Headshot.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_6gFDZzavM88/TTYURhs7ljI/AAAAAAAAADg/PnYhSuzzAS0/s72-c/onenotemobileiphone.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2011/01/microsoft-makes-onenote-free-on-iphone.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYCSHk4fCp7ImA9Wx9QGUU.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-1480813587627577719</id><published>2011-01-02T10:54:00.001-06:00</published><updated>2011-01-02T11:09:29.734-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-02T11:09:29.734-06:00</app:edited><title>Visual Studio STILL Calls It JScript?</title><content type="html">Just when I think Microsoft is gradually accepting some common community standards: embracing MVC, framework support of JSON, TDD...&lt;br /&gt;
&lt;br /&gt;
Today I am deploying a web app to &lt;a href="http://www.microsoft.com/windowsazure/"&gt;Azure&lt;/a&gt;, and I decide to write my current &lt;a href="http://www.sencha.com/"&gt;Sencha&lt;/a&gt; demo using Visual Studio 2010:&lt;br /&gt;
&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Javascript Intellisense - Check&lt;/li&gt;
&lt;li&gt;Easy Packaging to Azure - Check&lt;/li&gt;
&lt;li&gt;Familiar IDE - Check&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
I go to add my javascript file and I search for "Javascript" using the &lt;a href="http://visualstudiogallery.msdn.microsoft.com/en-us/d0d33361-18e2-46c0-8ff2-4adea1e34fef"&gt;handy power tools&lt;/a&gt; when adding files. &amp;nbsp;I type javascript - "No items found" Huh? &amp;nbsp;Turns out Microsoft still prefers to refer to the js files as JScript files. &amp;nbsp;Really? &amp;nbsp;It's 2011. &amp;nbsp;It is supposedly to avoid trademark issues with Sun:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;As explained by JavaScript guru&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Douglas_Crockford" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #0645ad; text-decoration: none;" title="Douglas Crockford"&gt;Douglas Crockford&lt;/a&gt;&amp;nbsp;in his talk entitled&amp;nbsp;&lt;i&gt;The JavaScript Programming Language&lt;/i&gt;&amp;nbsp;on&amp;nbsp;&lt;a class="new" href="http://en.wikipedia.org/w/index.php?title=YUI_Theater&amp;amp;action=edit&amp;amp;redlink=1" style="background-attachment: initial; background-clip: initial; background-color: initial; background-image: none; background-origin: initial; background-position: initial initial; background-repeat: initial initial; color: #cc2200; text-decoration: none;" title="YUI Theater (page does not exist)"&gt;YUI Theater&lt;/a&gt;, "[Microsoft] did not want to deal with Sun about the trademark issue, and so they called their implementation JScript. A lot of people think that JScript and JavaScript are different but similar languages. That's not the case. They are just different names for the same language, and the reason the names are different was to get around trademark issues."&lt;/blockquote&gt;&lt;br /&gt;
I seriously doubt that adding javascript in the name of the file you are creating in an IDE would violate trademark issues. &amp;nbsp;Every other IDE doesn't seem to have a problem it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-1480813587627577719?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/uBWl1bPWUfY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/1480813587627577719/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=1480813587627577719" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/1480813587627577719?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/1480813587627577719?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/uBWl1bPWUfY/visual-studio-still-calls-it-jscript.html" title="Visual Studio STILL Calls It JScript?" /><author><name>Brian Orrell</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="31" src="http://3.bp.blogspot.com/-7Ryf2QfYu10/T6Ggy9CMHiI/AAAAAAAAAFw/HNenTMg6Al8/s220/Headshot.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2011/01/visual-studio-still-calls-it-jscript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QBR3s9fip7ImA9Wx9RFE4.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-3255020527827309225</id><published>2010-12-15T10:39:00.002-06:00</published><updated>2010-12-15T10:42:36.566-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-15T10:42:36.566-06:00</app:edited><title>Chrome OS vs. Android</title><content type="html">I have to say that &lt;a href="http://techcrunch.com/2010/12/14/gmail-creator-paul-buchheit-chrome-os-will-perish-or-merge-with-android/"&gt;this post&lt;/a&gt; is spot-on.  I can't see both Chrome-OS and Android succeeding in the long run.  The benefits of Chrome-OS seem to be met and then some by Android and with the industry momentum around Android, I don't see how Chrome-OS can carve out a niche.  I'm willing to be proven wrong.  I still am a huge fan of Chrome and think it will take a great deal of market share (as it already has) from the other browsers, but the OS is a different story.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-3255020527827309225?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/mK6CiAFrYdc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/3255020527827309225/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=3255020527827309225" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/3255020527827309225?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/3255020527827309225?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/mK6CiAFrYdc/chrome-os-vs-android.html" title="Chrome OS vs. Android" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2010/12/chrome-os-vs-android.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D04BR3w8eSp7ImA9WxFSEUo.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-5096684095809639240</id><published>2010-04-06T15:24:00.003-05:00</published><updated>2010-04-13T11:25:56.271-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-04-13T11:25:56.271-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SalesForce.com" /><category scheme="http://www.blogger.com/atom/ns#" term="iPad" /><category scheme="http://www.blogger.com/atom/ns#" term="CRM" /><category scheme="http://www.blogger.com/atom/ns#" term="Apple" /><category scheme="http://www.blogger.com/atom/ns#" term="Microsoft" /><title>Microsoft Dynamics CRM and the iPad - Better Get Moving, Microsoft</title><content type="html">I assume out of the gate that SalesForce.com can run on the recently released iPad.  It's a browser app.  Why shouldn't it?  Good for SalesForce.&lt;br /&gt;&lt;br /&gt;Microsoft Dynamics CRM is an entirely different animal.  Even though CRM is a "browser app" it requires Windows IE - can't run it on Mac IE or Firefox or Chrome or Opera or anything else.  Kind of defeats the purpose of being a browser app, in my opinion.&lt;br /&gt;&lt;br /&gt;And who is one of the largest target demographics for the iPad?  Mobile Sales Professionals!  While it may pain Microsoft to have to play well on non-Microsoft OS's and browsers, if they want to stay relevant in this space, they better get moving.&lt;br /&gt;&lt;br /&gt;And yes, the iPad can terminal service in and run IE virtualized from Citrix, etc... but why should you have to?  If I were SalesForce.com, I would be marketing this for all it's worth.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-5096684095809639240?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/WvvuHBJbTyA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/5096684095809639240/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=5096684095809639240" title="17 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/5096684095809639240?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/5096684095809639240?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/WvvuHBJbTyA/microsoft-dynamics-crm-and-ipad-better.html" title="Microsoft Dynamics CRM and the iPad - Better Get Moving, Microsoft" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>17</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2010/04/microsoft-dynamics-crm-and-ipad-better.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYNQHo_fip7ImA9WxJRE04.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-4423095231633102807</id><published>2009-05-14T15:16:00.001-05:00</published><updated>2009-05-14T15:16:31.446-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-05-14T15:16:31.446-05:00</app:edited><title>Weathering an economic challenge as a consultancy</title><content type="html">&lt;p&gt;As we all experience one of the more challenging economic times in our history, it becomes even more critical to revisit how companies can stay resilient.&amp;#160; At Pariveda, we have asserted that even in the most challenging of times the information technology knowledge worker pool is supply-constrained.&amp;#160; Does this mean that over the past six months, layoffs in our industry haven't occurred?&amp;#160; Absolutely not.&amp;#160; They have.&amp;#160; But what we have experienced first hand, is that our clients are having a &lt;strong&gt;harder&lt;/strong&gt; time finding competent candidates.&lt;/p&gt;  &lt;p&gt;We think the reason is straightforward.&amp;#160; After the first and second rounds of layoffs within the IT industry, the bottom percentages of workers are typically the ones laid off first.&amp;#160; This has resulted in a larger overall pool of candidates with the same amount of good candidates as before-- the same number of &amp;quot;needles&amp;quot; (good candidates) in a much larger haystack.&amp;#160; &lt;/p&gt;  &lt;p&gt;We are investing in recruiting, training and growing our people now more than ever before.&amp;#160; We just hired a new recruiter, we continue our push for top-tier college graduates and experienced hires and our sales pipeline is strong.&amp;#160; Our clients continue to confirm our difference in the industry- our people.&amp;#160; &lt;/p&gt;  &lt;p&gt;Now more than ever companies cannot afford to go with &amp;quot;average&amp;quot; firms.&amp;#160; People's jobs are on the line and project success is critical.&amp;#160; Does it matter what the rate of a firm is if they fail to deliver the solution?&amp;#160; &lt;/p&gt;  &lt;p&gt;All of us at Pariveda could work at other places if we wanted; what keeps us at Pariveda is the ability to work with some of the most intellectually curious and talented folks in the industry.&amp;#160; Even in a down economy, we have fun and do interesting work.&amp;#160; The best way to beat the economic blues is to surround yourself with people who enjoy what they do, are interested in continuous learning and are focused on providing the most value possible for their clients.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-4423095231633102807?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/9xCE3Xqbpn8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/4423095231633102807/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=4423095231633102807" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/4423095231633102807?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/4423095231633102807?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/9xCE3Xqbpn8/weathering-economic-challenge-as.html" title="Weathering an economic challenge as a consultancy" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2009/05/weathering-economic-challenge-as.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkEMRHY4eCp7ImA9WxJTGE4.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-9085147582331258603</id><published>2009-04-25T11:12:00.001-05:00</published><updated>2009-04-27T08:24:45.830-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-27T08:24:45.830-05:00</app:edited><title>Dallas DevCares Presentation - REST Based Services</title><content type="html">&lt;p&gt;&lt;img src="http://www.msdnevents.com/devcares/images/Dev_Cares_Logo.png" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://parivedasolutions.com/Pages/Charles.aspx" target="_blank"&gt;Charles Knight&lt;/a&gt; did an awesome job presenting on RESTful Services in .NET.&amp;#160; &lt;a href="http://www.parivedasolutions.com/Downloads/DevCares_REST.pdf" target="_blank"&gt;Click here to download the presentation&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-9085147582331258603?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/JWEbNAQS_is" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/9085147582331258603/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=9085147582331258603" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/9085147582331258603?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/9085147582331258603?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/JWEbNAQS_is/dallas-devcares-presentation-rest-based.html" title="Dallas DevCares Presentation - REST Based Services" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2009/04/dallas-devcares-presentation-rest-based.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AFRns4eCp7ImA9WxdRGEg.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-4873250377040445793</id><published>2008-06-07T11:20:00.000-05:00</published><updated>2008-06-07T11:21:57.530-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-07T11:21:57.530-05:00</app:edited><title>Data Access with LINQ to SQL - Update</title><content type="html">&lt;p&gt;As with all new technologies, you continue to learn as you work with it.&amp;#160; Some of my thoughts have changed from my &lt;a href="http://borrell.parivedasolutions.com/2008/02/linq-to-sql-updating-in-aspnet-right.html"&gt;previous post&lt;/a&gt; on using LINQ to SQL.&lt;/p&gt;  &lt;p&gt;After attending TechEd 2008 in Orlando this past week and speaking recently on this topic at the Austin Code Camp, I have a (what I think) is a better approach to doing data access with LINQ to SQL in an ASP.NET web project.&amp;#160; First, it is definitely my preference to separate all data context activity to the business and/or data tiers.&lt;/p&gt;  &lt;p&gt;Some key things that I have learned along the way.&amp;#160; You will want to use the Attach(entity, true), which essentially tells LINQ to &amp;quot;trust me, the entity has changed, update the whole thing.&amp;quot;&amp;#160; In order for this to work with an entity that has relational entities such as the Customer with the CustomerAddress, you must do one of the following things:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Serialize and then deserialize the entity using the DataContractSerializer. This will be automatic if you are passing it over WCF, otherwise, you will need to write the code to essentially clone your entity.&lt;/li&gt;    &lt;li&gt;Use the DataLoadOptions to get the full entity graph when you pull down the original entity.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;I've started storing my code up on Google Code.&amp;#160; &lt;a href="http://brianorrell.googlecode.com/svn/trunk/Prescriptive%20Data%20Access%20in%203.5/"&gt;Here's a link to download the latest bits&lt;/a&gt;.&amp;#160; If you aren't already an SVN user, just download &lt;a href="http://tortoisesvn.net/downloads"&gt;TortoiseSVN&lt;/a&gt;-- trust me, it's easy.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:63d19e69-ec6b-4b34-b4e7-9ed0e031d5a2" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/LINQ" rel="tag"&gt;LINQ&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ASP.NET" rel="tag"&gt;ASP.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/DataContractSerializer" rel="tag"&gt;DataContractSerializer&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-4873250377040445793?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/8vddPoYWbn8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/4873250377040445793/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=4873250377040445793" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/4873250377040445793?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/4873250377040445793?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/8vddPoYWbn8/data-access-with-linq-to-sql-update.html" title="Data Access with LINQ to SQL - Update" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>8</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2008/06/data-access-with-linq-to-sql-update.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cNSXgycCp7ImA9WxdRF00.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-6519740128637114480</id><published>2008-06-05T16:23:00.001-05:00</published><updated>2008-06-05T16:24:58.698-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-05T16:24:58.698-05:00</app:edited><title>Slow Typing in Word and Outlook on your ThinkPad?</title><content type="html">&lt;p&gt;This was driving me absolutely crazy and hopefully it will help others (write a comment if it fixes your problem).&amp;#160; I was getting significant delay when I would type in Microsoft Word and Outlook and when it would and I could not figure out what the problem was.&amp;#160; I tried removing all my user settings, uninstalling/reinstalling Office.&amp;#160; Nothing worked.&lt;/p&gt;  &lt;p&gt;Turns out that the problem wasn't with Office at all.&amp;#160; It was the Client Security - Password Manager program that comes pre-installed on ThinkPad laptops with fingerprint scanners.&amp;#160; Uninstall it and everything works like it should.   &lt;br /&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9e485eb6-101d-40ce-8d15-08270ef6f934" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Outlook" rel="tag"&gt;Outlook&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Word" rel="tag"&gt;Word&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Slow" rel="tag"&gt;Slow&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Typing" rel="tag"&gt;Typing&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Lenovo" rel="tag"&gt;Lenovo&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ThinkPad" rel="tag"&gt;ThinkPad&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Password%20Manager" rel="tag"&gt;Password Manager&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-6519740128637114480?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/9f0UvTqfbQA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/6519740128637114480/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=6519740128637114480" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/6519740128637114480?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/6519740128637114480?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/9f0UvTqfbQA/slow-typing-in-word-and-outlook-on-your.html" title="Slow Typing in Word and Outlook on your ThinkPad?" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2008/06/slow-typing-in-word-and-outlook-on-your.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkUGQns8fip7ImA9WxZXE0U.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-4948168444131612013</id><published>2008-03-01T10:17:00.001-06:00</published><updated>2008-03-01T10:17:03.576-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-01T10:17:03.576-06:00</app:edited><title>How to trigger a full postback from within an AJAX UpdatePanel</title><content type="html">&lt;p&gt;If you've ever used an AJAX UpdatePanel and needed to have a control within the UpdatePanel cause a full postback of the page, here's how you do it.&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: #2b91af"&gt;ScriptManager&lt;/span&gt; scriptManager = &lt;span style="color: #2b91af"&gt;ScriptManager&lt;/span&gt;.GetCurrent(Page);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: blue"&gt;if&lt;/span&gt; (scriptManager != &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; scriptManager.RegisterPostBackControl(&lt;font color="#0000ff"&gt;SaveButton&lt;/font&gt;);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;First you have to get access to the ScriptManager on the page.&amp;#160; Then you register the control within the UpdatePanel that needs to trigger a full postback.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5ade7b8c-56b9-4a9f-af0a-b5ce645fa960" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/ASP.NET" rel="tag"&gt;ASP.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/AJAX" rel="tag"&gt;AJAX&lt;/a&gt;,&lt;a href="http://technorati.com/tags/UpdatePanel" rel="tag"&gt;UpdatePanel&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ScriptManager" rel="tag"&gt;ScriptManager&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-4948168444131612013?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/FR4bw_hfaBw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/4948168444131612013/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=4948168444131612013" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/4948168444131612013?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/4948168444131612013?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/FR4bw_hfaBw/how-to-trigger-full-postback-from.html" title="How to trigger a full postback from within an AJAX UpdatePanel" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2008/03/how-to-trigger-full-postback-from.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MMQH49fyp7ImA9WxZRFko.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-3120681522798347467</id><published>2008-02-10T14:31:00.001-06:00</published><updated>2008-02-10T14:31:21.067-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-02-10T14:31:21.067-06:00</app:edited><title>Visual Studio 2008 Hotfix Available</title><content type="html">&lt;p&gt;&lt;a href="http://lh5.google.com/brianorrell2/R69fFqmTEmI/AAAAAAAAAXA/xB-CFnbS6us/vs2008%5B6%5D?imgmax=800"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="70" alt="vs2008" src="http://lh6.google.com/brianorrell2/R69fF6mTEnI/AAAAAAAAAXI/RWXycCexrGY/vs2008_thumb%5B4%5D?imgmax=800" width="190" align="right" border="0" /&gt;&lt;/a&gt; Microsoft has released a hotfix for Visual Studio 2008... thankfully.&amp;#160; We had noticed some severe performance issues with VS 2008 since we started using it back in October.&amp;#160; Hopefully this will speed up my team's development and will resolve some stability issues.&lt;/p&gt;  &lt;p&gt;Here's a &lt;a title="Visual Studio 2008 Hotfix Download" href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=10826&amp;amp;wa=wsignin1.0" target="_blank"&gt;link&lt;/a&gt; to download the hotfix.&lt;/p&gt;  &lt;p&gt;And here's a &lt;a title="Scott Guthrie&amp;#39;s Details on Visual Studio 2008 Hotfix" href="http://weblogs.asp.net/scottgu/archive/2008/02/08/vs-2008-web-development-hot-fix-roll-up-available.aspx" target="_blank"&gt;link&lt;/a&gt; to Scott Guthrie's post on what was resolved with the hotfix.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-3120681522798347467?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/3igPE9iHrXA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/3120681522798347467/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=3120681522798347467" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/3120681522798347467?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/3120681522798347467?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/3igPE9iHrXA/visual-studio-2008-hotfix-available.html" title="Visual Studio 2008 Hotfix Available" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2008/02/visual-studio-2008-hotfix-available.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QARnoycCp7ImA9WxRTEk4.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-7897733935089089662</id><published>2008-02-09T15:41:00.001-06:00</published><updated>2008-08-31T22:22:27.498-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-08-31T22:22:27.498-05:00</app:edited><title>LINQ to SQL Updating in ASP.NET - The Right Way</title><content type="html">&lt;p&gt;&lt;strong&gt;&lt;em&gt;Update (6/7/2008): I have posted my thoughts on how this can be done in a more n-tier based way &lt;/em&gt;&lt;/strong&gt;&lt;a href="http://borrell.parivedasolutions.com/2008/06/data-access-with-linq-to-sql-update.html"&gt;&lt;strong&gt;&lt;em&gt;here&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;&lt;em&gt;.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Click &lt;a title="Source Code for LINQ to SQL Updating in ASP.NET - The Right Way" href="http://brianorrell.googlecode.com/svn/trunk/Prescriptive%20Data%20Access%20in%203.5/" target="_blank"&gt;here&lt;/a&gt; to download the source for these examples. This is a link to a Google Code repository.&amp;#160; Use subversion to check it out.&lt;/p&gt;  &lt;p&gt;Like many folks who have been creating web applications on the ASP.NET platform for a while, the glitz and glamour surrounding Language Integrated Query (LINQ) intrigued and frightened me at the same time.&amp;#160; All the demos seemed to imply that life was easier and clearer in the new world.&amp;#160; &lt;em&gt;Don't believe the hype.&lt;/em&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Don't get me wrong, LINQ is great if you understand the right way to use it and our teams at Pariveda are really getting some great traction out of LINQ to SQL, but you definitely have to approach it differently than most of the demos seem to imply.&amp;#160; The QUERY part of LINQ to SQL is straightforward and extremely powerful; the create, update and delete support in the language is what takes some getting used to. &lt;/p&gt;  &lt;p&gt;First off, it's good to understand the model that is used for LINQ to SQL Updates.&amp;#160; The entities that are passed around with LINQ to SQL are lightweight and do not store changed state information. The only things the entities do is store data and raise events when their properties change to other watching objects such as the DataContext-- and that is where folks get confused when working with LINQ in ASP.NET.&lt;/p&gt;  &lt;p&gt;Almost ALL applications these days work in a disconnected state.&amp;#160; Meaning there are process/memory differences between when and where data is initially RETRIEVED and when and where it is eventually UPDATED.&amp;#160; Herein lies the problem with most of the demos that show LINQ in action.&lt;/p&gt;  &lt;p&gt;ASP.NET web applications are and should remain stateless from an architectural implementation.&amp;#160; We have ways of &amp;quot;fooling&amp;quot; developers into believing that their pages are somehow living in memory using things like ViewState, but anyone who has worked in the tool long enough knows that ViewState is serialization/deserialization trickery to lull the developer into a stateful sense of well being.&amp;#160; I love me some ViewState, but you have to understand it to use it wisely.&lt;/p&gt;  &lt;p&gt;So, what's the problem with ASP.NET and LINQ.&amp;#160; When you perform an update with LINQ, the entity you are updating must be watched when the properties are updated to their new values.&amp;#160; &lt;/p&gt;  &lt;p&gt;Say, I have a page that displays a customer record:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="480" alt="Data Access Screen" src="http://lh3.google.com/brianorrell2/R64fVamTElI/AAAAAAAAAW0/fW1x-OsD_ns/image%5B33%5D?imgmax=800" width="367" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;On the SelectedIndexChanged of the ListBox, I would simply write some code that filled in the values in the TextBoxes like so:&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; CustomerListBox_SelectedIndexChanged(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt; db = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt;())&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt; customer = db.Customers.Single(c =&amp;gt; c.CustomerID ==&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;int&lt;/span&gt;.Parse(CustomerListBox.SelectedValue));&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; NameTextBox.Text = customer.CompanyName;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; EmailTextBox.Text = customer.EmailAddress;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FirstNameTextBox.Text = customer.FirstName;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; LastNameTextBox.Text = customer.LastName;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IsActiveCheckBox.Checked = customer.IsActive;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;We think all is well with the world.&amp;#160; Then we proceed to Update the Customer object by hooking into the Save Button's click event like so:&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; SaveButton_Click(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt; db = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt;())&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt; customer = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; { &lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CustomerID = &lt;span style="color: blue"&gt;int&lt;/span&gt;.Parse(CustomerListBox.SelectedValue) &lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; };&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; db.Customers.Attach(customer);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.CompanyName = NameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.EmailAddress = EmailTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.FirstName = FirstNameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.LastName = LastNameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.IsActive = IsActiveCheckBox.Checked;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; db.SubmitChanges();&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;And we get a &amp;quot;row not found or changed&amp;quot; error?&amp;#160; Why is this?&amp;#160; Because the datacontext uses concurrency checking to ensure that the data we originally retrieved has not changed between the time we retrieved it and the time we are attempting to update it.&amp;#160; Let's take a look at the SQL that was generated by the DataContext that caused the error:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;UPDATE [SalesLT].[Customer]        &lt;br /&gt;SET [FirstName] = @p0, [LastName] = @p1, [CompanyName] = @p2, [EmailAddress] = @p3WHERE 0 = 1         &lt;br /&gt;-- @p0: Input NVarChar (Size = 7; Prec = 0; Scale = 0) [Orlando]         &lt;br /&gt;-- @p1: Input NVarChar (Size = 3; Prec = 0; Scale = 0) [Gee]         &lt;br /&gt;-- @p2: Input NVarChar (Size = 13; Prec = 0; Scale = 0) [A Bike StoreX]         &lt;br /&gt;-- @p3: Input NVarChar (Size = 28; Prec = 0; Scale = 0) [orlando0@adventure-works.com]         &lt;br /&gt;-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.21022.8&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Notice, the WHERE 0=1 part?&amp;#160; What's up with that? &lt;/p&gt;  &lt;p&gt;The best way to start off solving this is to create a timestamp column in your table and hold on to this value in ViewState so that when you perform your Attach and Update, you can vouch for the fact that the data hasn't changed since the last time you retrieved it.&amp;#160; We'll call it the column &amp;quot;Version&amp;quot;.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="402" alt="Customer Table Definition" src="http://lh3.google.com/brianorrell2/R64eAamTEjI/AAAAAAAAAW8/GT5wz-1axNc/image%5B34%5D?imgmax=800" width="395" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Next, we'll create a ViewState-backed property that will hold onto the value of the currently selected version:&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: #2b91af"&gt;Binary&lt;/span&gt; SelectedCustomerVersion&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;get&lt;/span&gt; { &lt;span style="color: blue"&gt;return&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Binary&lt;/span&gt;)ViewState[&lt;span style="color: #a31515"&gt;&amp;quot;SelectedCustomerVersion&amp;quot;&lt;/span&gt;]; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;set&lt;/span&gt; { ViewState[&lt;span style="color: #a31515"&gt;&amp;quot;SelectedCustomerVersion&amp;quot;&lt;/span&gt;] = &lt;span style="color: blue"&gt;value&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;We'll set the Version property in our SelectedIndexChanged event of our ListBox like so:&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; CustomerListBox_SelectedIndexChanged(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt; db = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt;())&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt; customer = db.Customers.Single(c =&amp;gt; c.CustomerID ==&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;int&lt;/span&gt;.Parse(CustomerListBox.SelectedValue));&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; NameTextBox.Text = customer.CompanyName;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; EmailTextBox.Text = customer.EmailAddress;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FirstNameTextBox.Text = customer.FirstName;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; LastNameTextBox.Text = customer.LastName;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; IsActiveCheckBox.Checked = customer.IsActive;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SelectedCustomerVersion = customer.Version;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Finally, in our update code, we will be sure and set the Version value of our Customer entity before we attach to the data context.&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; SaveButton_Click(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt; db = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt;())&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt; customer = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CustomerID = &lt;span style="color: blue"&gt;int&lt;/span&gt;.Parse(CustomerListBox.SelectedValue),&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Version = SelectedCustomerVersion&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; };&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; db.Customers.Attach(customer);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.CompanyName = NameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.EmailAddress = EmailTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.FirstName = FirstNameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.LastName = LastNameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; customer.IsActive = IsActiveCheckBox.Checked;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; db.SubmitChanges();&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;And this works... MOST of the time.&amp;#160; You can be deceived into thinking you have things working until you understand what is actually occurring.&amp;#160; When you attach your customer entity to your datacontext, you are basically promising that the values you plan to change in your entity while your data context watches are ALREADY SET to the original values they were in the database.&amp;#160; The reason why this is important for LINQ is that your Customer entity will only alert the data context that something has changed if the value the property is changing FROM is different.&amp;#160; So how would you see this problem manifest itself? It will occur when you are setting a property back to the default value that it would already have when a new entity is created-- boolean values are the easiest ways to see the issue.&lt;/p&gt;  &lt;p&gt;If we we set the IsActive property from true to false, our current code won't work because the default value of a boolean is already false.&amp;#160; Let's look at what the SQL would look like if the ONLY thing we changed in the entity was the IsActive checkbox going from checked to unchecked (true to false).&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;UPDATE [SalesLT].[Customer]        &lt;br /&gt;SET [FirstName] = @p2, [LastName] = @p3, [CompanyName] = @p4, [EmailAddress] = @p5         &lt;br /&gt;WHERE ([CustomerID] = @p0) AND ([Version] = @p1) &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;SELECT [t1].[Version]        &lt;br /&gt;FROM [SalesLT].[Customer] AS [t1]         &lt;br /&gt;WHERE ((@@ROWCOUNT) &amp;gt; 0) AND ([t1].[CustomerID] = @p6)         &lt;br /&gt;-- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [1]         &lt;br /&gt;-- @p1: Input Timestamp (Size = 8; Prec = 0; Scale = 0) [SqlBinary(8)]         &lt;br /&gt;-- @p2: Input NVarChar (Size = 5; Prec = 0; Scale = 0) [Brian]         &lt;br /&gt;-- @p3: Input NVarChar (Size = 3; Prec = 0; Scale = 0) [Gee]         &lt;br /&gt;-- @p4: Input NVarChar (Size = 12; Prec = 0; Scale = 0) [A Bike Store]         &lt;br /&gt;-- @p5: Input NVarChar (Size = 28; Prec = 0; Scale = 0) [orlando0@adventure-works.com]         &lt;br /&gt;-- @p6: Input Int (Size = 0; Prec = 0; Scale = 0) [1]         &lt;br /&gt;-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.21022.8&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Notice, that even though the ONLY column we changed is the IsActive value from true to false, it was the &lt;strong&gt;&lt;em&gt;only&lt;/em&gt;&lt;/strong&gt; column that wasn't attempted to be updated by the database.&amp;#160; Let's examine why.&amp;#160; &lt;/p&gt;  &lt;p&gt;When you attach an entity to the datacontext, it is basically hooking up to be alerted everytime a property changes.&amp;#160;&amp;#160; Since we just created an empty customer from scratch and only set the CustomerID and Version properties on the entity, all of the other property values are null.&amp;#160; When we set CompanyName, it alerts that there was a change because we changed the property from null to a value, and the same for the other columns... except for IsActive.&amp;#160; The CURRENT value of IsActive is false and then we attempt to set the value of the property to false.&amp;#160; No change event is raised because the property isn't being changed and therefore the database is not updated during the SubmitChanges call.&lt;/p&gt;  &lt;p&gt;So, the last piece of the puzzle is coming up with a way to hold on to the original values of the customer entity so that before we attach the customer entity we set all the properties to their new values, the old values are already set.&amp;#160; This is the part that had my head spinning for a while.&amp;#160; At first, I tried putting the Customer entity directly into ViewState but it complained about a host of serialization problems-- you can try making it happen and see for yourself the problems that occur.&lt;/p&gt;  &lt;p&gt;The way I finally was able to get serialization of a LINQ entity to work was to set the dbml file to the Serialization Mode of Unidirectional.&amp;#160; You can do this by clicking in a blank area of the designer and then opening up the properties window.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="216" alt="DBML Serialization Settings" src="http://lh5.google.com/brianorrell2/R64eA6mTEkI/AAAAAAAAAWs/fi-X1iqUnCY/image%5B22%5D?imgmax=800" width="240" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Next, I created an OriginalCustomer property to store the object.&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt; OriginalCustomer { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Finally, I overrode the LoadViewState and SaveViewState methods of the page so that I could persist the deserialized string of&amp;#160; the OriginalCustomer property to ViewState.&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; LoadViewState(&lt;span style="color: blue"&gt;object&lt;/span&gt; savedState)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;object&lt;/span&gt;[] allStates = (&lt;span style="color: blue"&gt;object&lt;/span&gt;[])savedState;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;base&lt;/span&gt;.LoadViewState(allStates[0]);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; OriginalCustomer = &lt;span style="color: #2b91af"&gt;LinqEntityUtil&lt;/span&gt;.Deserialize&amp;lt;&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&amp;gt;((&lt;span style="color: blue"&gt;string&lt;/span&gt;)allStates[1]);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;override&lt;/span&gt; &lt;span style="color: blue"&gt;object&lt;/span&gt; SaveViewState()&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;object&lt;/span&gt; baseState = &lt;span style="color: blue"&gt;base&lt;/span&gt;.SaveViewState();&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;object&lt;/span&gt;[] allStates = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: blue"&gt;object&lt;/span&gt;[2];&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; allStates[0] = baseState;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; allStates[1] = &lt;span style="color: #2b91af"&gt;LinqEntityUtil&lt;/span&gt;.Serialize&amp;lt;&lt;span style="color: #2b91af"&gt;Customer&lt;/span&gt;&amp;gt;(OriginalCustomer);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; allStates;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Here's the utility class that handles the deserialization of LINQ Entities:&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&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: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;LinqEntityUtil&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Serializes a LINQ to SQL Entity to a WCF-Serialized &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; string using the DataContractSerializer&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;Type of the LINQ Entity to be serialized&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/typeparam&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param name=&amp;quot;linqEntity&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;LINQ Entity object to be serialized&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;Serialized string&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; Serialize&amp;lt;T&amp;gt;(T linqEntity)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;DataContractSerializer&lt;/span&gt; serializer = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DataContractSerializer&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(T));&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;StringWriter&lt;/span&gt; writer = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;StringWriter&lt;/span&gt;();&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;XmlTextWriter&lt;/span&gt; xmlWriter = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XmlTextWriter&lt;/span&gt;(writer);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; serializer.WriteObject(xmlWriter, linqEntity);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; writer.Flush();&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; writer.ToString();&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Deserializes from a string back to a LINQ to SQL Entity &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; object using the DataContractSerializer&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;Type of the LINQ Entity to be serialized&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/typeparam&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;param name=&amp;quot;xml&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;Serialized string to deserialize&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;LINQ Entity object&lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; T Deserialize&amp;lt;T&amp;gt;(&lt;span style="color: blue"&gt;string&lt;/span&gt; xml)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;DataContractSerializer&lt;/span&gt; serializer = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;DataContractSerializer&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(T));&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;StringReader&lt;/span&gt; reader = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;StringReader&lt;/span&gt;(xml);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: #2b91af"&gt;XmlTextReader&lt;/span&gt; xmlReader = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;XmlTextReader&lt;/span&gt;(reader);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; T linqEntity = (T)serializer.ReadObject(xmlReader);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; linqEntity;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Now, with my OriginalCustomer serialization in place, I could hold on to the original customer entity and attach it back to the datacontext when I was ready to save.&lt;/p&gt;  &lt;div style="border-right: #000000 1px solid; padding-right: 20px; border-top: #000000 1px solid; padding-left: 20px; font-size: 8pt; background: white; margin-bottom: 20px; padding-bottom: 20px; border-left: #000000 1px solid; width: 600px; color: black; padding-top: 20px; border-bottom: #000000 1px solid; font-family: lucida console; courier: "&gt;   &lt;p style="margin: 0px; line-height: 9pt"&gt;&lt;span style="color: blue"&gt;protected&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; SaveButton_Click(&lt;span style="color: blue"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af"&gt;EventArgs&lt;/span&gt; e)&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt; db = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;AdventureWorksDataContext&lt;/span&gt;())&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; db.Customers.Attach(OriginalCustomer);&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OriginalCustomer.CompanyName = NameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OriginalCustomer.EmailAddress = EmailTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OriginalCustomer.FirstName = FirstNameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OriginalCustomer.LastName = LastNameTextBox.Text;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OriginalCustomer.IsActive = IsActiveCheckBox.Checked;&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; db.SubmitChanges();&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px; line-height: 9pt"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;With this in place, I can make changes to IsActive where I set it from true to false and the data context &amp;quot;sees&amp;quot; the changes appropriately.&amp;#160; Here is the much more optimized SQL that occurs, when I change just the IsActive field. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font face="Courier New"&gt;UPDATE [SalesLT].[Customer]        &lt;br /&gt;SET [IsActive] = @p2         &lt;br /&gt;WHERE ([CustomerID] = @p0) AND ([Version] = @p1) &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;&lt;font face="Courier New"&gt;SELECT [t1].[Version]        &lt;br /&gt;FROM [SalesLT].[Customer] AS [t1]         &lt;br /&gt;WHERE ((@@ROWCOUNT) &amp;gt; 0) AND ([t1].[CustomerID] = @p3)         &lt;br /&gt;-- @p0: Input Int (Size = 0; Prec = 0; Scale = 0) [1]         &lt;br /&gt;-- @p1: Input Timestamp (Size = 8; Prec = 0; Scale = 0) [SqlBinary(8)]         &lt;br /&gt;-- @p2: Input Bit (Size = 0; Prec = 0; Scale = 0) [False]         &lt;br /&gt;-- @p3: Input Int (Size = 0; Prec = 0; Scale = 0) [1]         &lt;br /&gt;-- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.21022.8&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Hopefully this helps some of you struggling with similar issues.&amp;#160; The key thing when using attach is that you want all of the properties that you plan to change to be set to their original values &lt;strong&gt;&lt;em&gt;before&lt;/em&gt;&lt;/strong&gt; you attach it to the datacontext and ViewState serialization is the easiest way to do that in ASP.NET.&lt;/p&gt;  &lt;p&gt;Click &lt;a title="Source Code for LINQ to SQL Updating in ASP.NET - The Right Way" href="http://www.4shared.com/file/37375799/b4e9f0fc/ParivedaDataAccess35_-_Blog.html" target="_blank"&gt;here&lt;/a&gt; to download the source for these examples.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9ed331c3-9a5f-43f8-9e59-a444fc59565f" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/LINQ" rel="tag"&gt;LINQ&lt;/a&gt;,&lt;a href="http://technorati.com/tags/ASP.NET" rel="tag"&gt;ASP.NET&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Serialization" rel="tag"&gt;Serialization&lt;/a&gt;,&lt;a href="http://technorati.com/tags/WCF" rel="tag"&gt;WCF&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-7897733935089089662?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/Ug-kx63HQZw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/7897733935089089662/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=7897733935089089662" title="36 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/7897733935089089662?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/7897733935089089662?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/Ug-kx63HQZw/linq-to-sql-updating-in-aspnet-right.html" title="LINQ to SQL Updating in ASP.NET - The Right Way" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>36</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2008/02/linq-to-sql-updating-in-aspnet-right.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUIGSXw6cCp7ImA9WxZSGEo.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-7852376393720341108</id><published>2008-02-01T08:52:00.001-06:00</published><updated>2008-02-01T08:52:08.218-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-02-01T08:52:08.218-06:00</app:edited><title>Bill Gates' Last Day</title><content type="html">&lt;p&gt;Too funny not to post&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:587efbc9-8cf0-492a-9d85-e24dfbc9fb37" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;div&gt;&lt;embed src="http://images.video.msn.com/flash/soapbox1_1.swf" quality="high" width="432" height="364" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://macromedia.com/go/getflashplayer" flashvars="c=v&amp;v=9aead1b8-e615-45ae-8665-becc282cc783&amp;ifs=true&amp;fr=msnvideo&amp;mkt=en-US&amp;brand=&amp;from=writer"&gt;&lt;/embed&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-7852376393720341108?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/_621gGj14bk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/7852376393720341108/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=7852376393720341108" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/7852376393720341108?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/7852376393720341108?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/_621gGj14bk/bill-gates-last-day.html" title="Bill Gates&amp;#39; Last Day" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2008/02/bill-gates-last-day.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIBQXw6eyp7ImA9WxZSFkw.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-7161330312517874107</id><published>2008-01-28T11:19:00.001-06:00</published><updated>2008-01-29T07:32:30.213-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-29T07:32:30.213-06:00</app:edited><title>We Are Microsoft - Great Event</title><content type="html">&lt;p&gt;&lt;a href="http://lh4.google.com/brianorrell2/R58q6-O5zlI/AAAAAAAAAV8/Faz8WQI3EV0/TexasCares%5B5%5D?imgmax=800"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="184" alt="TexasCares" src="http://lh6.google.com/brianorrell2/R58q7eO5zmI/AAAAAAAAAWE/5kVa5LE-daY/TexasCares_thumb%5B3%5D?imgmax=800" width="244" align="left" border="0" /&gt;&lt;/a&gt; It's been a week now since our two teams from Pariveda volunteered at the &lt;a href="http://www.wearemicrosoft.com" target="_blank"&gt;We Are Microsoft&lt;/a&gt; event.&amp;#160;&amp;#160; Toi Wright and &lt;a href="http://blogs.msdn.com/chkoenig/" target="_blank"&gt;Chris Koenig&lt;/a&gt; did a &lt;strong&gt;&lt;em&gt;great&lt;/em&gt;&lt;/strong&gt; job organizing the event.&lt;/p&gt;  &lt;p&gt;My team which had Jeff Townes, Justin Finch and Kyle Stock from Pariveda and Amy Stewart from &lt;a href="http://www.stewartdesign.com/" target="_blank"&gt;Stewart Design&lt;/a&gt; was assigned to Texas CARES, a cat rescue group here in North Texas.&amp;#160; Beyond some initial phone discussions where we worked through logistics and timing for the weekend, we started out with a clean slate on Friday evening.&amp;#160; &lt;/p&gt;  &lt;p&gt;Over the course of two and half days, we developed a revamped website with a searchable and maintainable database for managing rescued cats and helping pair them up with adoptive owners.&amp;#160; &lt;/p&gt;  &lt;p&gt;To see the improvement, here's a link to their &lt;a href="http://www.texascares.org/" target="_blank"&gt;current site&lt;/a&gt;. Here's a &lt;a href="http://texascares.microsoft-j.net/" target="_blank"&gt;link&lt;/a&gt; to the new site (in beta as we work through transferring domain registration).&amp;#160; Here's a &lt;a href="http://docs.geekswithblogs.net/WeAreMicrosoft/TexasCares/TexasCares.mp3"&gt;link to the interview&lt;/a&gt; that Geeks with Blogs did with Carol Benassi, the president of Texas CARES and me, and here's &lt;a href="http://docs.geekswithblogs.net/WeAreMicrosoft/SearchAndRescue/SearchAndRescue/SearchAndRescue.mp3"&gt;another link&lt;/a&gt; to the interview they did with the Texas Response Unit Search and Rescue (the second Pariveda team).&lt;/p&gt;  &lt;p&gt;One of the things that makes Pariveda unique is that we have an expectation that all of our folks participate in community service.&amp;#160; Depending upon the person's level (it increases the higher up you go), there are a certain number of hours that are expected you commit to community service.&amp;#160; We Are Microsoft was a great way to be able to help our community by doing the things that we do best- develop great software.&lt;/p&gt;  &lt;p&gt;We each spent around 40 hours between Friday night until late Sunday afternoon.&amp;#160; It took us a while to recover, but I was extremely proud of both teams.&amp;#160; By the way, our two teams from Pariveda came in First and Third in the competition-- Woo Hoo!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-7161330312517874107?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/BrOMzlrixxo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/7161330312517874107/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=7161330312517874107" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/7161330312517874107?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/7161330312517874107?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/BrOMzlrixxo/we-are-microsoft-great-event.html" title="We Are Microsoft - Great Event" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2008/01/we-are-microsoft-great-event.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYMSH0yfCp7ImA9WxdWE0g.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-6757126489239162706</id><published>2008-01-01T17:17:00.001-06:00</published><updated>2008-07-06T09:06:29.394-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-07-06T09:06:29.394-05:00</app:edited><title>ObjectDataSource / LINQ / Paging / Sorting Example</title><content type="html">&lt;p class="MsoNormal"&gt;&lt;strong&gt;[Edit: Updated link to download code]      &lt;br /&gt;&lt;/strong&gt;&lt;a href="http://brianorrell.googlecode.com/svn/trunk/Pariveda.ObjectDataSource/" target="_blank"&gt;Click here to download&lt;/a&gt; the source for these examples.&amp;#160; This is out on GoogleCode.&amp;#160; I recommend &lt;a href="http://tortoisesvn.net/downloads" target="_blank"&gt;TortoiseSVN&lt;/a&gt; to download the code.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;One of the first issues you encounter when doing .NET development the &amp;#8220;Right Way&amp;#8221;/&amp;#8221;Pariveda Way&amp;#8221; is finding an example of how to support paging and sorting in a GridView.&amp;#160; Many of the examples out on the web assume you are using a SqlDataSource to get at your data.&amp;#160; If you are developing against an N-Tier architecture, you know you will need to use the ObjectDataSource, but there are few examples that show how to support paging and sorting when using this model. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;This example will hopefully point you in the right direction for how to support paging and sorting using an ObjectDataSource.&amp;#160; In addition, it will show you a method for supporting multiple search criteria where a user may or may not choose to filter on all the criteria available&amp;#8212;LINQ has a great story around this topic. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Here&amp;#8217;s the scenario, we need a Grid to display a list of products (Product Name, Category Name, and Supplier Name) from the Northwind database.&amp;#160; The grid can be filtered on the Category, the Supplier or both.&amp;#160; In addition, the grid can be sorted by any of the three columns by clicking on the columns.&amp;#160; Sorting on the Category or Supplier should also use a secondary sort by Product since there will be multiple records for each Category and/or Supplier when sorted. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;The grid should look like this: &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="359" alt="clip_image001" src="http://lh4.google.com/brianorrell2/R4LHHhRnDMI/AAAAAAAAATY/uvtf6-1skQ8/clip_image001%5B6%5D?imgmax=800" width="631" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;One of the primary reasons we advocate using a business tier and the ObjectDataSource is to support writing tests against your code (it&amp;#8217;s difficult and not all that useful to write web testing code, so we choose to have as much code as possible isolated to our business and data tiers).&amp;#160; In true Test Driven Development fashion, let&amp;#8217;s start by creating the tests that we will use to test out our Business layer code before we write anything else. We are using NUnit, but you can use whatever testing framework you want). &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Let&amp;#8217;s create a project and solution called &lt;b&gt;Pariveda.ObjectDataSource.Test&lt;/b&gt; inside a solution called &lt;b&gt;Pariveda.ObjectDataSource&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="392" alt="clip_image001[7]" src="http://lh3.google.com/brianorrell2/R4LJERRnDNI/AAAAAAAAATg/COtV8yFEdys/clip_image001%5B7%5D%5B5%5D?imgmax=800" width="454" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="581" alt="clip_image001[9]" src="http://lh4.google.com/brianorrell2/R4LJEhRnDOI/AAAAAAAAATo/lTYhgVqmFKA/clip_image001%5B9%5D%5B5%5D?imgmax=800" width="812" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;After creating our first project in the new solution, let&amp;#8217;s also add two new projects to the solution: &lt;b&gt;Pariveda.ObjectDataSource.Business&lt;/b&gt; (Windows Class Library) and &lt;b&gt;Pariveda.ObjectDataSource.Web&lt;/b&gt; (ASP.NET Web Application). &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="414" alt="clip_image001[11]" src="http://lh6.google.com/brianorrell2/R4LJFBRnDPI/AAAAAAAAATw/rtDQ_GX3glY/clip_image001%5B11%5D%5B4%5D?imgmax=800" width="489" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Next, we need to add our references.&amp;#160; Both &lt;b&gt;Test&lt;/b&gt; and &lt;b&gt;Web&lt;/b&gt; need to point to the &lt;b&gt;Business&lt;/b&gt; Project as a reference so they can use the business layer code. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="409" alt="clip_image001[13]" src="http://lh4.google.com/brianorrell2/R4LJFhRnDQI/AAAAAAAAAT4/3mgsZnHNGIM/clip_image001%5B13%5D%5B5%5D?imgmax=800" width="480" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Also, let&amp;#8217;s add a reference to the nunit.framework.dll in our &lt;b&gt;Test&lt;/b&gt; project. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;So let&amp;#8217;s work on adding at least the stub for our Business library method for retrieving a list of Products.&amp;#160; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;First let&amp;#8217;s add a &amp;#8220;LINQ to SQL Classes&amp;#8221; file: &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="494" alt="clip_image001[15]" src="http://lh6.google.com/brianorrell2/R4LJGBRnDRI/AAAAAAAAAUA/mLeHO3dcbtU/clip_image001%5B15%5D%5B5%5D?imgmax=800" width="815" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Next we&amp;#8217;ll drag the Category, Product and Supplier tables from the Server Explorer (the Northwind database is included with the zipped up solution I have a link to). &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="693" alt="clip_image001[17]" src="http://lh3.google.com/brianorrell2/R4LJGRRnDSI/AAAAAAAAAUI/QcPwGDGhxjE/clip_image001%5B17%5D%5B5%5D?imgmax=800" width="593" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;First, let&amp;#8217;s create an entity class in our Business Library that will store our grid results.&amp;#160; We will call it &lt;b&gt;ProductGetListResult&lt;/b&gt;.&amp;#160; This will enable us to have a more optimized call that only returns the key information we need to display for our grid. &lt;/p&gt;  &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 9pt; background: white; border-left: black 1px solid; color: black; line-height: 8pt; border-bottom: black 1px solid; font-family: consolas"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ProductGetListResult&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; ProductName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; CategoryName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;string&lt;/span&gt; SupplierName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Next, we&amp;#8217;ll create a class called &lt;b&gt;ProductController&lt;/b&gt; in the Business Library.&amp;#160; Our main method will be called &lt;b&gt;GetList&lt;/b&gt;. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;We know the parameters will need to be the following: &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;An optional categoryId parameter to filter by category &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;An optional supplierId parameter to filter by supplier &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;A sortType indicating the sort order &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;A startRowIndex parameter for use with paging to support starting at a specified row &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;A maximumRows parameter for indicating how many total rows to retrieve &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 10pt; background: white; padding-bottom: 5px; border-left: black 1px solid; color: black; padding-top: 5px; border-bottom: black 1px solid; font-family: consolas"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;ProductGetListResult&lt;/span&gt;&amp;gt; GetList(&lt;span style="color: blue"&gt;int&lt;/span&gt;? categoryId, &lt;span style="color: blue"&gt;int&lt;/span&gt;? supplierId, &lt;span style="color: blue"&gt;string&lt;/span&gt; sortType, &lt;span style="color: blue"&gt;int&lt;/span&gt; startRowIndex, &lt;span style="color: blue"&gt;int&lt;/span&gt; maximumRows)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;NorthwindDataContext&lt;/span&gt; db = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;NorthwindDataContext&lt;/span&gt;())&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//First we start with the base query&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;var&lt;/span&gt; productQuery = &lt;span style="color: blue"&gt;from&lt;/span&gt; p &lt;span style="color: blue"&gt;in&lt;/span&gt; db.Products&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;select&lt;/span&gt; p;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//Next we filter if category or supplier has been specified&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = GetListQuery(productQuery, categoryId, supplierId);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//Sort the query&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = GetListSort(productQuery, sortType);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//Use the Skip and Take methods to limit the results to the page requested&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.Skip(startRowIndex).Take(maximumRows);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//Project results into a ligher weight class and actually execute the query by&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//calling the ToList method&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; productQuery.Select(p =&amp;gt; &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ProductGetListResult&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ProductName = p.ProductName,&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; SupplierName = p.Supplier.CompanyName,&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; CategoryName = p.Category.CategoryName&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }).ToList();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p class="MsoNormal"&gt;We are creating an instance of our DataContext (being sure to use a disposing &amp;#8220;use&amp;#8221; statement on the object to ensure the data context and subsequent data connections are closed). &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;We do four things in this method: &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;We dynamically filter based on our criteria (category and supplier ids) &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;We dynamically sort based on our sortType parameter &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;We return a subset of the information based on the startRowIndex and maximumRows parameters &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoListParagraph" style="margin-left: 0.75in; text-indent: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;span style="font-family: symbol; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"&gt;&lt;span style="mso-list: ignore"&gt;&amp;#183;&lt;span roman??="roman??" new="new" times="times"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;We then project the results into our lightweight list of ProductGetListResults &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Let&amp;#8217;s look at the &lt;b&gt;GetListQuery&lt;/b&gt; method. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="font-size: 10pt; background: white; color: black; font-family: consolas"&gt;   &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 10pt; background: white; padding-bottom: 5px; border-left: black 1px solid; color: black; padding-top: 5px; border-bottom: black 1px solid; font-family: consolas"&gt;     &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IQueryable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Product&lt;/span&gt;&amp;gt; GetListQuery(&lt;span style="color: #2b91af"&gt;IQueryable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Product&lt;/span&gt;&amp;gt; productQuery, &lt;span style="color: blue"&gt;int&lt;/span&gt;? categoryId, &lt;span style="color: blue"&gt;int&lt;/span&gt;? supplierId)&lt;/p&gt;      &lt;p style="margin: 0px"&gt;{&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//Only filter by category id if specified (query not executed here either)&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (categoryId.HasValue &amp;amp;&amp;amp; categoryId.Value &amp;gt; 0)&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.Where(p =&amp;gt; p.CategoryID == categoryId.Value);&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//Only filter by supplier id if specified (query not executed here either)&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (supplierId.HasValue &amp;amp;&amp;amp; supplierId.Value &amp;gt; 0)&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.Where(p =&amp;gt; p.SupplierID == supplierId.Value);&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//Return the query (Query isn't even executed when we return it)&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; productQuery;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;}&lt;/p&gt;   &lt;/div&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt; &lt;/div&gt;  &lt;p class="MsoNormal"&gt;What we are doing in this method is very similar to things we have done in the past prior to LINQ where we would build dynamic SQL except we get strong-typing and intellisense.&amp;#160; In addition, we get all the benefits for prevention of SQL injection attacks etc. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Now let&amp;#8217;s look at the sorting. &lt;/p&gt;  &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 9pt; background: white; border-left: black 1px solid; color: black; line-height: 8pt; border-bottom: black 1px solid; font-family: consolas"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: #2b91af"&gt;IQueryable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Product&lt;/span&gt;&amp;gt; GetListSort(&lt;span style="color: #2b91af"&gt;IQueryable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Product&lt;/span&gt;&amp;gt; productQuery, &lt;span style="color: blue"&gt;string&lt;/span&gt; sortType)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//Determining whether to sort ascending or descending &lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//(GridView appends DESC if the column is clicked on twice to indicate a descending sort)&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;bool&lt;/span&gt; sortDescending = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (!&lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.IsNullOrEmpty(sortType))&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;string&lt;/span&gt;[] values = sortType.Split(&lt;span style="color: #a31515"&gt;' '&lt;/span&gt;);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sortType = values[0];&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (values.Length &amp;gt; 1)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; sortDescending = values[1] == &lt;span style="color: #a31515"&gt;&amp;quot;DESC&amp;quot;&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;switch&lt;/span&gt; (sortType)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;case&lt;/span&gt; &lt;span style="color: #a31515"&gt;&amp;quot;CategoryName&amp;quot;&lt;/span&gt;:&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (sortDescending)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.OrderByDescending(p =&amp;gt; p.Category.CategoryName)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ThenBy(p =&amp;gt; p.ProductName); ;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.OrderBy(p =&amp;gt; p.Category.CategoryName)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ThenBy(p =&amp;gt; p.ProductName); ;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;break&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;case&lt;/span&gt; &lt;span style="color: #a31515"&gt;&amp;quot;SupplierName&amp;quot;&lt;/span&gt;:&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (sortDescending)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.OrderByDescending(p =&amp;gt; p.Supplier.CompanyName)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ThenBy(p =&amp;gt; p.ProductName);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.OrderBy(p =&amp;gt; p.Supplier.CompanyName)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; .ThenBy(p =&amp;gt; p.ProductName);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;break&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;default&lt;/span&gt;:&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;if&lt;/span&gt; (sortDescending)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.OrderByDescending(p =&amp;gt; p.ProductName);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;else&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = productQuery.OrderBy(p =&amp;gt; p.ProductName);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;break&lt;/span&gt;;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: green"&gt;//The query has not executed during this method, it is only setting up the query for execution&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; productQuery;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p class="MsoNormal"&gt;We are basically doing two things, first we are seeing if a direction specifier is attached to our sortType parameter.&amp;#160; The GridView automatically appends DESC to the end of the sortType parameter when a user clicks on a column twice (once for ascending, twice for descending).&amp;#160; Next we are switching on the SortType which is a string and we are then using strong typing to sort on the column.&amp;#160; Notice that for CategoryName and SupplierName we also do a secondary sort on ProductName since only sorting on Category or Supplier isn&amp;#8217;t specific enough. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;Big point about the benefits of LINQ: &lt;/b&gt;Please note that throughout all of this code, nothing is being executed on the database.&amp;#160; That is one of the main benefits of LINQ: delayed execution.&amp;#160; The only time SQL Server is contacted and the query is executed is when we first access the collection neither by enumerating through it or in this case, when we call the &lt;b&gt;ToList&lt;/b&gt; method. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Now here&amp;#8217;s where many folks get hung up.&amp;#160; In order for the ObjectDataSource to correctly support paging, you need one more method, &lt;b&gt;GetListCount&lt;/b&gt;.&amp;#160; If you think about it, it becomes obvious why this is required.&amp;#160; We are only returning a subset of records back to the ObjectDataSource (a page&amp;#8217;s worth).&amp;#160; The GridView has to know how many total rows are available so that it can correctly show the right number of links to the different page numbers.&amp;#160; Since we separated the call for filtering from the rest of the code, we can easily use the same method in our &lt;b&gt;GetListCount&lt;/b&gt; method. &lt;/p&gt;  &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 9pt; background: white; border-left: black 1px solid; color: black; line-height: 8pt; border-bottom: black 1px solid; font-family: consolas"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;int&lt;/span&gt; GetListCount(&lt;span style="color: blue"&gt;int&lt;/span&gt;? categoryId, &lt;span style="color: blue"&gt;int&lt;/span&gt;? supplierId)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;NorthwindDataContext&lt;/span&gt; db = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;NorthwindDataContext&lt;/span&gt;())&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;var&lt;/span&gt; productQuery = &lt;span style="color: blue"&gt;from&lt;/span&gt; p &lt;span style="color: blue"&gt;in&lt;/span&gt; db.Products&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;select&lt;/span&gt; p;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = GetListQuery(productQuery, categoryId, supplierId);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; productQuery.Count();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Here we simply call the Count() method on our query.&amp;#160; You may be thinking to yourself, &amp;#8220;Hey, isn&amp;#8217;t that two calls to the database?&amp;#8221; and you would be correct.&amp;#160; While this is true, this is the most optimized query you can do if you need both a SUBSET of the data for paging and yet you also need the total row count. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;In addition to our &lt;b&gt;ProductController&lt;/b&gt;, I created two additional controller classes:&amp;#160; &lt;b&gt;CategoryController&lt;/b&gt; and &lt;b&gt;SupplierController&lt;/b&gt;. &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&amp;#160;&lt;/p&gt;  &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 9pt; background: white; border-left: black 1px solid; color: black; line-height: 8pt; border-bottom: black 1px solid; font-family: consolas"&gt;   &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: blue"&gt;int&lt;/span&gt; GetListCount(&lt;span style="color: blue"&gt;int&lt;/span&gt;? categoryId, &lt;span style="color: blue"&gt;int&lt;/span&gt;? supplierId)&lt;/p&gt;    &lt;p style="margin: 0px"&gt;{&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;using&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;NorthwindDataContext&lt;/span&gt; db = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;NorthwindDataContext&lt;/span&gt;())&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; {&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;var&lt;/span&gt; productQuery = &lt;span style="color: blue"&gt;from&lt;/span&gt; p &lt;span style="color: blue"&gt;in&lt;/span&gt; db.Products&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;select&lt;/span&gt; p;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; productQuery = GetListQuery(productQuery, categoryId, supplierId);&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return&lt;/span&gt; productQuery.Count();&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; }&lt;/p&gt;    &lt;p style="margin: 0px"&gt;}&lt;/p&gt; &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;Now to use it! &lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;In order to create our web page, we don&amp;#8217;t need to use any code-behind logic.&amp;#160; It can all be accomplished declaratively using the ObjectDataSource.&amp;#160; In order to clean up the aspx code and to follow best practices, we are using a MasterPage for css styling and AJAX support.&amp;#160; In addition, we are using App_Themes for our GridView so we don&amp;#8217;t see any messy formatting within the aspx page. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;First, let&amp;#8217;s add our two drop down lists to the page.&amp;#160; We&amp;#8217;ll add a CategoryDropDownList and a SupplierDropDownList. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="105" alt="clip_image001[19]" src="http://lh4.google.com/brianorrell2/R4LJGhRnDTI/AAAAAAAAAUQ/8DEC_og52wM/clip_image001%5B19%5D%5B5%5D?imgmax=800" width="255" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="566" alt="clip_image001[21]" src="http://lh6.google.com/brianorrell2/R4LJHBRnDUI/AAAAAAAAAUY/hXUObUGCjC0/clip_image001%5B21%5D%5B5%5D?imgmax=800" width="754" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="571" alt="clip_image001[23]" src="http://lh3.google.com/brianorrell2/R4LJHRRnDVI/AAAAAAAAAUg/afDYxCsT0mc/clip_image001%5B23%5D%5B5%5D?imgmax=800" width="760" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="560" alt="clip_image001[25]" src="http://lh5.google.com/brianorrell2/R4LJHxRnDWI/AAAAAAAAAUo/xlY2S7bu-mw/clip_image001%5B25%5D%5B5%5D?imgmax=800" width="756" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="557" alt="clip_image001[27]" src="http://lh6.google.com/brianorrell2/R4LJIBRnDXI/AAAAAAAAAUw/XjD8Zfoo4AU/clip_image001%5B27%5D%5B6%5D?imgmax=800" width="755" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Notice we select &amp;#8220;Value&amp;#8221; as the data field to display and &amp;#8220;Key&amp;#8221; as the data field for the value.&amp;#160; These two properties map to the Id and the Name that we return from the business controller classes. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="568" alt="clip_image001[29]" src="http://lh4.google.com/brianorrell2/R4LJIhRnDYI/AAAAAAAAAU4/RPH_YoPYpgQ/clip_image001%5B29%5D%5B5%5D?imgmax=800" width="756" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;First thing, we&amp;#8217;ll add a GridView to the page, and click on the chevron arrow to set our Data Source.&amp;#160; We&amp;#8217;ll select &amp;#8220;New data source.&amp;#8221; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="180" alt="image" src="http://lh5.google.com/brianorrell2/R4LJIxRnDZI/AAAAAAAAAVA/nYGembYzXMQ/image%5B5%5D?imgmax=800" width="470" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;We will select &amp;#8220;Object&amp;#8221; as our Data Source Type and call it ProductObjectDataSource. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="576" alt="clip_image001[31]" src="http://lh3.google.com/brianorrell2/R4LJJRRnDaI/AAAAAAAAAVI/W3pIVydQI5s/clip_image001%5B31%5D%5B5%5D?imgmax=800" width="761" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;We&amp;#8217;ll pick our ProductController in the next screen&amp;#8230; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="553" alt="clip_image001[33]" src="http://lh4.google.com/brianorrell2/R4LJJhRnDbI/AAAAAAAAAVQ/yacDgsLU9Xw/clip_image001%5B33%5D%5B5%5D?imgmax=800" width="751" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;We&amp;#8217;ll select our &lt;b&gt;GetList&lt;/b&gt; method from the drop down. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="552" alt="clip_image001[35]" src="http://lh6.google.com/brianorrell2/R4LJKBRnDcI/AAAAAAAAAVY/CczLuRDpalE/clip_image001%5B35%5D%5B5%5D?imgmax=800" width="751" border="0" /&gt;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Now we hook up our two parameters in the GetList method to the SelectedValue properties of the DropDownList controls &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="556" alt="clip_image001[37]" src="http://lh4.google.com/brianorrell2/R4LJKhRnDdI/AAAAAAAAAVg/1NNjKahborU/clip_image001%5B37%5D%5B5%5D?imgmax=800" width="751" border="0" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Next, we will modify the DropDownList controls to support an &amp;#8220;-All-&amp;#8220; property and ensure the GridView refreshes when we change the filters.&amp;#160; I find it easier to change these properties in the &amp;#8220;Source&amp;#8221; view of the aspx editor.&amp;#160; Note the AppendDataBoundItems ensures that even though we are binding to an ObjectDataSource, the existing ListItem (the &amp;#8220;-All-&amp;#8220; option) still remains. &lt;/p&gt;  &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 9pt; background: white; border-left: black 1px solid; color: black; line-height: 8pt; border-bottom: black 1px solid; font-family: consolas"&gt;   &lt;p style="margin: 0px"&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;DropDownList&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SupplierDropDownList&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;AutoPostBack&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SupplierObjectDataSource&amp;quot;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;DataTextField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Value&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;AppendDataBoundItems&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DataValueField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Key&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &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;ListItem&lt;/span&gt; &lt;span style="color: red"&gt;Value&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;-1&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;- All Suppliers -&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&amp;lt; span&amp;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;DropDownList&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&amp;#160;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;Now, we need to tell the GridView that we will be using Paging (check the Enable Paging checkbox): &lt;/p&gt;    &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 9pt; background: white; border-left: black 1px solid; color: black; line-height: 8pt; border-bottom: black 1px solid; font-family: consolas"&gt;     &lt;p style="margin: 0px"&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;GridView&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GridView1&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;AllowPaging&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;EnableSortingAndPagingCallbacks&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;AllowSorting&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;600px&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;False&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DataSourceID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ProductObjectSource&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &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;BoundField&lt;/span&gt; &lt;span style="color: red"&gt;DataField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ProductName&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;HeaderText&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;$ Resources:ObjectDataSource, ProductLabel &lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SortExpression&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ProductName&amp;quot;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;ItemStyle-Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;250px&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;HeaderStyle-HorizontalAlign&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &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;BoundField&lt;/span&gt; &lt;span style="color: red"&gt;DataField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CategoryName&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;HeaderText&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;$ Resources:ObjectDataSource, CategoryLabel &lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SortExpression&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CategoryName&amp;quot;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;ItemStyle-Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;100px&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;HeaderStyle-HorizontalAlign&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &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;BoundField&lt;/span&gt; &lt;span style="color: red"&gt;DataField&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SupplierName&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;HeaderText&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;$ Resources:ObjectDataSource, SupplierLabel &lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SortExpression&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SupplierName&amp;quot;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;ItemStyle-Width&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;250px&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;HeaderStyle-HorizontalAlign&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;      &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&amp;lt; span&amp;gt;&lt;span style="color: #a31515"&gt;Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;        &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;EmptyDataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;        &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &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;Localize&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: #a31515"&gt;meta&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;resourcekey&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;EmptyData&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;        &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&amp;lt; span&amp;gt;&lt;span style="color: #a31515"&gt;EmptyDataTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;          &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&amp;lt; span&amp;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;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;          &lt;p&gt;&amp;#160;&lt;/p&gt;          &lt;p&gt;&amp;#160;&lt;/p&gt;          &lt;p class="MsoNormal"&gt;We&amp;#8217;ll use the &amp;#8220;Edit Columns&amp;#8221; option on the GridView to set the headers appropriately. &lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="515" alt="clip_image001[39]" src="http://lh5.google.com/brianorrell2/R4LJKxRnDeI/AAAAAAAAAVo/vF0B-eieH_Q/clip_image001%5B39%5D%5B5%5D?imgmax=800" width="671" border="0" /&gt;&lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p&gt;&lt;/p&gt;          &lt;p class="MsoNormal"&gt;Here&amp;#8217;s where the &amp;#8220;wizards&amp;#8221; breakdown and it gets &amp;#8220;hokey.&amp;#8221;&amp;#160; You must add the &lt;b&gt;SelectCountMethod&lt;/b&gt; and set it to the name of our GetListCount method, you must add the EnablePaging and the SortParameterName properties as well.&amp;#160; And then you have to &lt;b&gt;delete&lt;/b&gt; the sort and paging parameters that were automatically added to the ObjectDataSource when we set it up (sortType, startRowIndex, maximumRows). &lt;/p&gt;          &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 9pt; background: white; border-left: black 1px solid; color: black; line-height: 8pt; border-bottom: black 1px solid; font-family: consolas"&gt;           &lt;p style="margin: 0px"&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;ObjectDataSource&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ProductObjectSource&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;EnablePaging&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;/p&gt;            &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;OldValuesParameterFormatString&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;original_{0}&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SelectCountMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GetListCount&amp;quot;&lt;/span&gt;&lt;/p&gt;            &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;SelectMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GetList&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SortParameterName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;sortType&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;TypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Pariveda.ObjectDataSource.Business.ProductController&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;            &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;SelectParameters&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;            &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &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;ControlParameter&lt;/span&gt; &lt;span style="color: red"&gt;ControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CategoryDropDownList&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DefaultValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;null&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;categoryId&amp;quot;&lt;/span&gt;&lt;/p&gt;            &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;PropertyName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SelectedValue&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Int32&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;            &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &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;ControlParameter&lt;/span&gt; &lt;span style="color: red"&gt;ControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SupplierDropDownList&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DefaultValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;null&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;supplierId&amp;quot;&lt;/span&gt;&lt;/p&gt;            &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;PropertyName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SelectedValue&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Int32&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;            &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&amp;lt; span&amp;gt;&lt;span style="color: #a31515"&gt;SelectParameters&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&amp;lt; span&amp;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;ObjectDataSource&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;              &lt;p&gt;&amp;#160;&lt;/p&gt;              &lt;p&gt;Whew!&amp;#160; Now run it and confirm that it works as expected. &lt;/p&gt;              &lt;p&gt;&lt;/p&gt;              &lt;p&gt;&lt;/p&gt;              &lt;p class="MsoNormal"&gt;To add to the look and feel, use &lt;a href="http://quickstarts.asp.net/QuickStartv20/aspnet/doc/themes/themes.aspx#folder"&gt;ASP.NET theming&lt;/a&gt; to set the styles of both the GridView and the general layout of the page. &lt;/p&gt;              &lt;p&gt;&lt;/p&gt;              &lt;p&gt;&lt;/p&gt;              &lt;p class="MsoNormal"&gt;Next we can easily add AJAX functionality so we don&amp;#8217;t get those pesky postbacks.&amp;#160; First we can use the built-in GridView functionality to switch pages and sorts without postbacks.&amp;#160; Then we put the GridView inside and AJAX UpdatePanel and set the triggers to be based on the DropDownLists. &lt;/p&gt;              &lt;div style="border-right: black 1px solid; padding-right: 5px; border-top: black 1px solid; padding-left: 5px; font-size: 9pt; background: white; border-left: black 1px solid; color: black; line-height: 8pt; border-bottom: black 1px solid; font-family: consolas"&gt;               &lt;p style="margin: 0px"&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;ObjectDataSource&lt;/span&gt; &lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ProductObjectSource&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;EnablePaging&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;True&amp;quot;&lt;/span&gt;&lt;/p&gt;                &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;OldValuesParameterFormatString&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;original_{0}&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SelectCountMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GetListCount&amp;quot;&lt;/span&gt;&lt;/p&gt;                &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;SelectMethod&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;GetList&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;SortParameterName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;sortType&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;TypeName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Pariveda.ObjectDataSource.Business.ProductController&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;                &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;SelectParameters&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;                &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &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;ControlParameter&lt;/span&gt; &lt;span style="color: red"&gt;ControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;CategoryDropDownList&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DefaultValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;null&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;categoryId&amp;quot;&lt;/span&gt;&lt;/p&gt;                &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;PropertyName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SelectedValue&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Int32&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;                &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &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;ControlParameter&lt;/span&gt; &lt;span style="color: red"&gt;ControlID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SupplierDropDownList&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;DefaultValue&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;null&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;supplierId&amp;quot;&lt;/span&gt;&lt;/p&gt;                &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;PropertyName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;SelectedValue&amp;quot;&lt;/span&gt; &lt;span style="color: red"&gt;Type&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Int32&amp;quot;&lt;/span&gt; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/p&gt;                &lt;p style="margin: 0px"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;&amp;lt;/&amp;lt; span&amp;gt;&lt;span style="color: #a31515"&gt;SelectParameters&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;                  &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&amp;lt; span&amp;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;ObjectDataSource&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;                  &lt;p class="MsoNormal"&gt;&amp;#160;&lt;/p&gt;                  &lt;p class="MsoNormal"&gt;Hopefully, this was easy enough to follow.&amp;#160; Once you get the hang of it and get over some of the initial hurdles, it is easy to maintain and apply to different applications.&amp;#160; &lt;/p&gt;                  &lt;p class="MsoNormal"&gt;&lt;a href="http://www.4shared.com/file/33669076/6caef5ce/ParivedaObjectDataSource.html" target="_blank"&gt;Click here to download&lt;/a&gt; the source for these examples.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-6757126489239162706?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/162A5YhZ4vw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/6757126489239162706/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=6757126489239162706" title="34 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/6757126489239162706?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/6757126489239162706?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/162A5YhZ4vw/objectdatasource-linq-paging-sorting.html" title="ObjectDataSource / LINQ / Paging / Sorting Example" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>34</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2008/01/objectdatasource-linq-paging-sorting.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IFR3czcCp7ImA9WxdRGU8.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-4759227498686522599</id><published>2007-05-19T07:48:00.000-05:00</published><updated>2008-06-08T07:51:56.988-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-08T07:51:56.988-05:00</app:edited><title>MSBuild: Copy Files to Multiple Folders With One Copy Task</title><content type="html">&lt;p&gt;&lt;/p&gt;  &lt;p&gt;At Pariveda, we typically use a standard Config project in Visual Studio to keep track of all our configuration files and accessor classes.&amp;#160; We then write MSBuild scripts to deploy them to the appropriate web, service, winform, wpf, wcf directories as appropriate.&amp;#160; This provides the ability to maintain a single set of config files even if they are being deployed to multiple application source environments.&lt;/p&gt;  &lt;p&gt;This is especially appropriate with testing frameworks such as nUnit and Team Test.&amp;#160; In order to test effectively, many files need to be copied to the running test directory as well as the main application directory.&amp;#160; Instead of having to write duplicate msbuild tasks for copying to these directories, it would be nice if we could iterate through a list of directories that the files needed to be copied to.&lt;/p&gt;  &lt;p&gt;You see this question being asked all the time: How do I recursively copy a series of files to another folder?&amp;#160; That question has been &lt;a href="http://blogs.msdn.com/msbuild/archive/2005/11/07/490068.aspx"&gt;answered multiple times on multiple sites.&lt;/a&gt; But what about needing to copy that same series of files to multiple different deployment folders?&amp;#160; The scenario is like the one I described above or if you were wanting to automate deployment of files to a web farm.&amp;#160; The answer is using the ItemGroup appropriately.&amp;#160; If you can create an ItemGroup that contains the list of deployment directories that need to receive the files, you can write the script once that will iterate over this list of deployment directories and copy them to all of them.&lt;/p&gt;  &lt;p&gt;MSBuild is certainly not as intuitive to me as NAnt.&amp;#160; NAnt seems to be more understandable proceduraly (foreach tasks, etc) while MSBuild is more geared towards XSL type transformations.&amp;#160; Once I got the hang of how to use ItemGroups, however, I can see how powerful MSBuild as a scripting language can be.&lt;/p&gt;  &lt;div class="singlepost"&gt;   &lt;div style="font-size: 10pt; background: white; color: black; font-family: lucida console"&gt;&lt;span style="color: blue"&gt;       &lt;div style="font-size: 10pt; background: white; color: black; font-family: lucida console"&gt;&lt;span style="color: blue"&gt;           &lt;div style="font-size: 10pt; background: white; color: black; font-family: lucida console"&gt;             &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Project&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;DefaultTargets&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;CopyConfig&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;http://schemas.microsoft.com/developer/msbuild/2003&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; Define the list of directories to be copied to &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;PropertyGroup&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigFolder&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;c:\msbuild\config&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigFolder&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;PropertyGroup&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; Setup the directories to deploy to &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigDeploy&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;Include&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Service&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;c:\msbuild\Service&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigDeploy&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigDeploy&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;Include&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Test&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;c:\msbuild\Test&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Path&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ConfigDeploy&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; Now the task that copies the config files&lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Target&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;CopyConfig&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;Condition&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;'@(ConfigDeploy)'!=''&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; Delete any pre-existing deployment folders (Optional but good for testing) &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;RemoveDir&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;Directories&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;%(ConfigDeploy.Path)&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; Get all Files within the config directory and create multiple sets of the files&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: green"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; with metadata that describes where the files are to be deployed to &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;CreateItem&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;Include&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;$(ConfigFolder)\**\*.*&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;AdditionalMetadata&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ToDir=%(ConfigDeploy.Path)&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Output&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Include&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;ItemName&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ConfigFilesToDeploy&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;CreateItem&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&amp;#160;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt; Now copy all of the files to the appropriate folders &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Copy&lt;/span&gt;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;SourceFiles&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;@(ConfigFilesToDeploy)&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: red"&gt;DestinationFolder&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;%(ToDir)\%(RecursiveDir)&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Target&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;              &lt;p style="margin: 0px"&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Project&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;           &lt;/div&gt;         &lt;/span&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;     &lt;/span&gt;&lt;/div&gt; &lt;/div&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:6a9de3a7-336e-4cc3-9fa0-684f70795309" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/MSBuild" rel="tag"&gt;MSBuild&lt;/a&gt;,&lt;a href="http://technorati.com/tags/Copy" rel="tag"&gt;Copy&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-4759227498686522599?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/SMW9mMiMBHc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/4759227498686522599/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=4759227498686522599" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/4759227498686522599?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/4759227498686522599?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/SMW9mMiMBHc/msbuild-copy-files-to-multiple-folders.html" title="MSBuild: Copy Files to Multiple Folders With One Copy Task" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2007/05/msbuild-copy-files-to-multiple-folders.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A08FQn4-cCp7ImA9WxdRGU8.&quot;"><id>tag:blogger.com,1999:blog-600691149406565027.post-9101506889767320133</id><published>2004-10-19T07:55:00.000-05:00</published><updated>2008-06-08T07:56:53.058-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-08T07:56:53.058-05:00</app:edited><title>Regex.Replace()</title><content type="html">&lt;p&gt;&lt;/p&gt;  &lt;p&gt;Many times, we have a need for creating templates with key areas that are tagged for replacement.&amp;#160; An example would be a mail-merge type form letter.&lt;/p&gt;  &lt;p&gt;Dear [NAME],&lt;/p&gt;  &lt;p&gt;We have reviewed your account: [ACCOUNTNUMBER].&amp;#160; The issue you identified has been resolved.&amp;#160; [COMMENTS]&lt;/p&gt;  &lt;p&gt;Sincerely,    &lt;br /&gt;[COMPANYNAME]&lt;/p&gt;  &lt;p&gt;Most of the time, this is done with some brute force string.Replace command for every &lt;em&gt;possible&lt;/em&gt; field that may have been tagged in the document.&lt;/p&gt;  &lt;pre&gt;        public string MergeFields(string text)&lt;br /&gt;        {&lt;br /&gt;            text = text.Replace(&amp;quot;[NAME]&amp;quot;, _name);&lt;br /&gt;            text = text.Replace(&amp;quot;[ACCOUNTNUMBER&amp;quot;], _accountNumber);&lt;br /&gt;            text = text.Replace(&amp;quot;[COMMENTS]&amp;quot;, _comments);&lt;br /&gt;            text = text.Replace(&amp;quot;[COMPANYNAME]&amp;quot;, _companyName);&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This will work, but as the number of possible fields increases, your MergeFields method gets incredibly unwieldy.&amp;#160; Enter Regex.Replace.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;pre&gt;        public string MergeFields(string text)&lt;br /&gt;        {&lt;br /&gt;            string fieldPattern = @&amp;quot;\[(?&amp;lt;Field&amp;gt;[A-Z]+)\]&amp;quot;;&lt;br /&gt;            return Regex.Replace(text, fieldPattern, new MatchEvaluator(GetFieldValue));&lt;br /&gt;        }&lt;/pre&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;        private static Hashtable _fieldProps = new Hashtable();&lt;br /&gt;        private string GetFieldValue(Match m)&lt;br /&gt;        {&lt;br /&gt;            string fieldName = m.Groups[&amp;quot;Field&amp;quot;].Value;&lt;br /&gt;            PropertyInfo propInfo = (PropertyInfo)_fieldProps[fieldName];&lt;br /&gt;            if (propInfo == null)&lt;br /&gt;            {&lt;br /&gt;                Type type = typeof(RequestMailer);&lt;br /&gt;                propInfo = type.GetProperty(fieldName, typeof(string));&lt;br /&gt;                if (propInfo == null)&lt;br /&gt;                    throw new ArgumentException(m.Value + &amp;quot; is not a valid property.&amp;quot;);&lt;br /&gt;                _fieldProps.Add(fieldName, propInfo);&lt;br /&gt;            }&lt;br /&gt;            return (string)propInfo.GetValue(this, new object[0]);&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;So what's happening?&amp;#160; The Regex Replace method takes a regular expression pattern.&amp;#160; In this case it finds all occurences of [ALLCAPS].&amp;#160; When it finds a match, it &lt;em&gt;passes the matched value&lt;/em&gt; to our GetFieldValue method.&amp;#160; The GetFieldValue method uses reflection to find the property and get the value from the property.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;How does this help?&amp;#160; As we have the need to add more and more new custom properties, all we have to do is add the property itself.&amp;#160; The replacing methods do not need to be updated for the new properties to be used.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:89e35419-949f-4874-b357-f62145bb72b0" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/Regex" rel="tag"&gt;Regex&lt;/a&gt;,&lt;a href="http://technorati.com/tags/MailMerge" rel="tag"&gt;MailMerge&lt;/a&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/600691149406565027-9101506889767320133?l=borrell.parivedasolutions.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/BrianOrrell/~4/8dSC_yh9jV4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://borrell.parivedasolutions.com/feeds/9101506889767320133/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=600691149406565027&amp;postID=9101506889767320133" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/9101506889767320133?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/600691149406565027/posts/default/9101506889767320133?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/BrianOrrell/~3/8dSC_yh9jV4/regexreplace.html" title="Regex.Replace()" /><author><name>Brian</name><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="22" height="32" src="http://3.bp.blogspot.com/-8cOtQuXlrNI/Txn4p9AA9lI/AAAAAAAAAcU/Aqe05QqIsl0/s220/Thanksgiving%2B2011.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://borrell.parivedasolutions.com/2004/10/regexreplace.html</feedburner:origLink></entry></feed>

