﻿<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://developers.de/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx<description>One of important benefits of LINQ is that it enables you to write type-safe queries in VB and C#. Unfortunately there are Business cases cases where you want the flexibility to dynamically construct queries on the fly and damage type safety of Linq. </description><dc:language>en</dc:language><generator>CommunityServer 2008 SP1 (Build: 30619.63)</generator><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#392331<pubdate>Tue, 16 Oct 2012 00:38:02 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:392331</guid><dc:creator>dragan</dc:creator><description>&lt;p&gt;Svaka cast majstore - ubih se trazeci resenje&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=392331" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#284089<pubdate>Thu, 05 Apr 2012 14:16:28 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:284089</guid><dc:creator>Alain</dc:creator><description>&lt;p&gt;Just try DataBinder.Eval&lt;/p&gt;
&lt;p&gt;Example :&lt;/p&gt;
&lt;p&gt;pListSource = (From aa In pListSource Order By DataBinder.Eval(aa, varName)).ToList&lt;/p&gt;
&lt;p&gt;Just replace varName by your variable name and you will be able to sort by name !&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=284089" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#271261<pubdate>Thu, 09 Feb 2012 14:40:40 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:271261</guid><dc:creator>Marc</dc:creator><description>&lt;p&gt;Thanx for the good example! It helped me ordering some columns&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=271261" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#271266<pubdate>Mon, 30 Jan 2012 23:04:25 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:271266</guid><dc:creator>UD</dc:creator><description>&lt;p&gt;Greatest article on this topic out of the many I came across. Simple, &amp;nbsp;nice and clean. Saved my time a lot. Keep up the good work. Thanks a lot&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=271266" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#43203<pubdate>Fri, 22 Apr 2011 08:16:18 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:43203</guid><dc:creator>developers.de</dc:creator><description>&lt;p&gt;Linq orderby and dynamic query sample.. Smashing :)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=43203" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#28691<pubdate>Thu, 23 Dec 2010 15:43:04 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:28691</guid><dc:creator>Rathin Pandya</dc:creator><description>&lt;p&gt;very good example&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=28691" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#28386<pubdate>Fri, 26 Nov 2010 21:56:57 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:28386</guid><dc:creator>Damir Dobric</dc:creator><description>&lt;p&gt;LINQ to Entities does not recognize the method in general! The example I have shown above works with LINQ to objects only.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=28386" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#28344<pubdate>Wed, 24 Nov 2010 09:27:52 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:28344</guid><dc:creator>Lasse</dc:creator><description>&lt;p&gt;I tried the solution, but got an exception :&lt;/p&gt;
&lt;p&gt;LINQ to Entities does not recognize the method &amp;#39;System.Object TestOrderBy(String, OrderVO)&amp;#39; method, and this method cannot be translated into a store expression.&lt;/p&gt;
&lt;p&gt;How come ? Somebody know or had an expirence with this problem ?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Lasse&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=28344" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#28343<pubdate>Wed, 24 Nov 2010 09:27:30 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:28343</guid><dc:creator>Lasse</dc:creator><description>&lt;p&gt;I tried the solution, but got an exception :&lt;/p&gt;
&lt;p&gt;LINQ to Entities does not recognize the method &amp;#39;System.Object TestOrderBy(String, OrderVO)&amp;#39; method, and this method cannot be translated into a store expression.&lt;/p&gt;
&lt;p&gt;How come ? Somebody know or had an expirence with this problem ?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Lasse&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=28343" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#13007<pubdate>Mon, 05 Jul 2010 11:46:31 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:13007</guid><dc:creator>Chris Kimpton</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;RE: dynamically choosing ascending/descending, I found this post:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://weblogs.asp.net/davidfowler/archive/2008/12/11/dynamic-sorting-with-linq.aspx"&gt;weblogs.asp.net/.../dynamic-sorting-with-linq.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards, Chris&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=13007" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#13004<pubdate>Mon, 05 Jul 2010 09:48:32 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:13004</guid><dc:creator>Chris Kimpton</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for this.&lt;/p&gt;
&lt;p&gt;Like @ile, I&amp;#39;d like to also dynamically, ie user selected, choose between asc/desc.&lt;/p&gt;
&lt;p&gt;I wonder if the &amp;quot;descending&amp;quot; keyword could come from a function...&lt;/p&gt;
&lt;p&gt;Thanks, Chris&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=13004" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#13087<pubdate>Tue, 29 Jun 2010 11:26:46 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:13087</guid><dc:creator>Danny</dc:creator><description>&lt;p&gt;I get the error cannot orderby by type object&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=13087" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#12665<pubdate>Mon, 07 Jun 2010 18:41:47 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:12665</guid><dc:creator>Krishantha</dc:creator><description>&lt;p&gt;orderby Orderby(sortKey, city) decending&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=12665" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#12618<pubdate>Wed, 02 Jun 2010 10:14:17 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:12618</guid><dc:creator>ile</dc:creator><description>&lt;p&gt;How to dynamically sort &amp;quot;descending&amp;quot; (not ascending)?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;Ilija&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=12618" width="1" height="1"&gt;</description></item><item><title>re: LINQ, “orderby” and dynamic query sample</title><link />http://developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx#11385<pubdate>Thu, 15 Apr 2010 19:39:27 GMT</pubdate><guid ispermalink="false">7e491611-45ad-4dae-a68f-c4cb64439510:11385</guid><dc:creator>Will</dc:creator><description>&lt;p&gt;Perfect solution...just what I was looking for&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://developers.de/aggbug.aspx?PostID=11385" width="1" height="1"&gt;</description></item></channel></rss>