<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-6907873803403737979.post8759535853052018020..comments</id><updated>2012-01-20T18:51:33.652Z</updated><category term='List.aspx'/><category term='white-space: nowrap'/><category term='Custom Filter'/><category term='ListActionPath'/><category term='Y/N Field'/><category term='Database Based Permissions'/><category term='Default Sort Column'/><category term='ItemTemplate'/><category term='Regular Expressions'/><category term='Linq join'/><category term='Model'/><category term='DetailsView'/><category term='France'/><category term='DomainDataSource'/><category term='Web Application Project'/><category term='Searching'/><category term='Roles'/><category term='Conversion'/><category term='Job'/><category term='Live Writer'/><category term='LayoutTemplate'/><category term='DynamicField'/><category term='FileImage_Edit'/><category term='css'/><category term='FromView'/><category term='Conditional'/><category term='IQueryable'/><category term='Session variables'/><category term='Grouping'/><category term='SP1 Release'/><category term='Extension Methods'/><category term='Linq to SQL'/><category term='ReadOnlyAttribute'/><category term='ITemplate'/><category term='PDF to Image'/><category term='Required Field'/><category term='History'/><category term='DynamicData'/><category term='Preview 4'/><category term='Events'/><category term='Preview'/><category term='File Upload'/><category term='DynamicControl'/><category term='Dynamic Data Futures'/><category term='Hierarchical'/><category term='GridView Pager Size'/><category term='DataContext'/><category term='DynamicHyperLink'/><category term='LightSwitch'/><category term='Watermark'/><category term='TypeDescriptor'/><category term='jQuery'/><category term='I&apos;m Back'/><category term='Rollover'/><category term='Compound Properties'/><category term='Row Highlighting'/><category term='ITemplate class'/><category term='GridView'/><category term='ObjectContext'/><category term='MVP'/><category term='CustomTypeDescriptor'/><category term='AJAX HTML Editor'/><category term='UIHint'/><category term='Vacation'/><category term='Blogger'/><category term='Templates'/><category term='InsertItemTemplate'/><category term='CTP4'/><category term='Hide Column'/><category term='NuGet'/><category term='Agile Principals'/><category term='FieldTemplate'/><category term='Custom Field Templates'/><category term='Expression Trees'/><category term='User Filter'/><category term='ASP.Net'/><category term='Looking for a Job'/><category term='Entity Framework'/><category term='Default Values'/><category term='Cascading FieldTemplates'/><category term='PDF To Text'/><category term='DynamicDataFutures'/><category term='OnSavingChanges'/><category term='Sorting'/><category term='Camp-Hôtel Pachacaïd'/><category term='Cascading Controls'/><category term='Business Logic/Validation'/><category term='MataTable'/><category term='Pascal to Human'/><category term='DynamicDataExtensions'/><category term='Permissions'/><category term='Syntax Highlighter'/><category term='ABCpdf .Net 7'/><category term='CTP'/><category term='I18N'/><category term='ForeignKey_Edit'/><category term='Security'/><category term='IAutoFieldGenerator'/><category term='Visual Studio 2010'/><category term='Build-5/23a'/><category term='RegisterControl'/><category term='Digsby'/><category term='ToArray'/><category term='VB Code'/><category term='Dynamic Data Filtering'/><category term='Advertisement'/><category term='Custom Page Template'/><category term='FilterUserControl'/><category term='Command Column'/><category term='Limit FilterRepeater'/><category term='Image Handler'/><category term='Links'/><category term='Routing Constraint'/><category term='Routing'/><category term='TypeDescriptionProvider'/><category term='Autocomplete'/><category term='ListView'/><category term='Read-Only'/><category term='Code First'/><category term='OnDataBind'/><category term='GetColumnValue'/><category term='.Net 4.0'/><category term='Metadata'/><category term='Linq to Entities'/><category term='Validation Groups'/><category term='FilterTemplates'/><category term='DisplayColumnAttribute'/><category term='Holiday'/><category term='DomainService'/><category term='ASP.Net 4.0'/><category term='Cascading Filters'/><category term='Filtering'/><category term='Web User Controls'/><category term='CustomValidator'/><category term='EditItemTemplate'/><category term='Custom Meta Classes'/><category term='Generics'/><category term='File Based Website'/><category term='Custom Pages'/><category term='Add Preview to Web Site'/><category term='Render'/><category term='Multi Column Search'/><category term='ForeignKey Columns'/><category term='Attributes'/><category term='Visual Studio 2008 SP1 beta'/><category term='AJAX History'/><category term='Children'/><category term='Linq'/><category term='Validation'/><category term='External Class Library'/><category term='Patterns and Practices in C#'/><category term='Multiple Models'/><category term='Filters'/><category term='Partial Methods'/><category term='Dynamic Data'/><category term='Custom Attribute'/><category term='GetActionPath'/><category term='Attribute Based Permission'/><category term='MetaColumn'/><category term='Password'/><category term='Entity Templates'/><category term='OrderBy'/><category term='Silverlight'/><category term='AJAX Control Toolkit'/><category term='Books'/><title type='text'>Comments on C# Bits: Setting the Initial Sort Order – Dynamic Data</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://csharpbits.notaclue.net/feeds/8759535853052018020/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html'/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.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><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-3933353765214418451</id><published>2012-01-20T18:51:33.652Z</published><updated>2012-01-20T18:51:33.652Z</updated><title type='text'>Glad you like it Jim

Steve</title><content type='html'>Glad you like it Jim&lt;br /&gt;&lt;br /&gt;Steve</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/3933353765214418451'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/3933353765214418451'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1327085493652#c3933353765214418451' title=''/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1202627566'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-8212170971402120565</id><published>2012-01-20T18:38:43.769Z</published><updated>2012-01-20T18:38:43.769Z</updated><title type='text'>Hi Steve,

I don&amp;#39;t know how I found this post ...</title><content type='html'>Hi Steve,&lt;br /&gt;&lt;br /&gt;I don&amp;#39;t know how I found this post but it was a great help, and also got me to learn about extension methods.&lt;br /&gt;&lt;br /&gt;Thanks again and I&amp;#39;m bookmarking your site.&lt;br /&gt;&lt;br /&gt;Thanks,&lt;br /&gt;&lt;br /&gt;Jim</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8212170971402120565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8212170971402120565'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1327084723769#c8212170971402120565' title=''/><author><name>Jimbo</name><uri>http://www.blogger.com/profile/00317044340390254418</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1565561825'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-4755489790617706900</id><published>2011-08-03T18:48:22.602+01:00</published><updated>2011-08-03T18:48:22.602+01:00</updated><title type='text'>Hi Jonathan, I don;t do it that way anymore with ....</title><content type='html'>Hi Jonathan, I don;t do it that way anymore with .Net 4. I do it liek this, much more relyable.&lt;br /&gt;&lt;br /&gt;// set default sort&lt;br /&gt;if (table.SortColumn != null)&lt;br /&gt;{&lt;br /&gt;    var order = new OrderByExpression()&lt;br /&gt;    {&lt;br /&gt;        DataField = table.SortColumn.Name,&lt;br /&gt;        Direction = table.SortDescending ? SortDirection.Descending : SortDirection.Ascending,&lt;br /&gt;    };&lt;br /&gt;    queryExtender.Expressions.Add(order);&lt;br /&gt;}</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/4755489790617706900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/4755489790617706900'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1312393702602#c4755489790617706900' title=''/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1202627566'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-6901199205270051484</id><published>2011-08-03T18:09:15.091+01:00</published><updated>2011-08-03T18:09:15.091+01:00</updated><title type='text'>To expand on Stuart Whiteford&amp;#39;s code example, ...</title><content type='html'>To expand on Stuart Whiteford&amp;#39;s code example, the order by syntax when working with an EntityDataSource is slightly different:&lt;br /&gt;&lt;br /&gt;string orderBy = String.Format(&amp;quot;it.{0} {1}&amp;quot;, displayColumn.SortColumn, displayColumn.SortDescending ? &amp;quot;desc&amp;quot; : &amp;quot;asc&amp;quot;);&lt;br /&gt;GridDataSource.OrderBy = orderBy;&lt;br /&gt;&lt;br /&gt;Also, excluding this sorting code from post backs (as fabiocanada pointed out) allows for re-sorting by the user, but after a delete, for example, the default sort order is lost. The user can then re-sort using the column headers but it&amp;#39;s not a good user experience , especially when there are several pages of data.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/6901199205270051484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/6901199205270051484'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1312391355091#c6901199205270051484' title=''/><author><name>Jonathan Moreau</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1516701291'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-5304051571292533621</id><published>2011-03-26T01:07:38.022Z</published><updated>2011-03-26T01:07:38.022Z</updated><title type='text'>Glad it does Yuri :)

Steve</title><content type='html'>Glad it does Yuri :)&lt;br /&gt;&lt;br /&gt;Steve</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/5304051571292533621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/5304051571292533621'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1301101658022#c5304051571292533621' title=''/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1202627566'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-7822594697535516198</id><published>2011-03-25T16:59:23.863Z</published><updated>2011-03-25T16:59:23.863Z</updated><title type='text'>Hi Steve,

QueryExtender works fine to me.

Thank ...</title><content type='html'>Hi Steve,&lt;br /&gt;&lt;br /&gt;QueryExtender works fine to me.&lt;br /&gt;&lt;br /&gt;Thank you</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/7822594697535516198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/7822594697535516198'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1301072363863#c7822594697535516198' title=''/><author><name>Yuri</name><uri>http://www.blogger.com/profile/18368917593547953867</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1891523458'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-8255783027287545083</id><published>2011-03-24T19:16:33.246Z</published><updated>2011-03-24T19:16:33.246Z</updated><title type='text'>Hi Yuri, you can just apply multiple column name t...</title><content type='html'>Hi Yuri, you can just apply multiple column name to the GridView sort, also if you are using VS2010 and .Net 4 then you can add a sort to QueryExtender that should give you the control.&lt;br /&gt;&lt;br /&gt;Steve</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8255783027287545083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8255783027287545083'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1300994193246#c8255783027287545083' title=''/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1202627566'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-6697401717789404302</id><published>2011-03-24T18:31:16.231Z</published><updated>2011-03-24T18:31:16.231Z</updated><title type='text'>Hi Steve,

  Nice tip, but I have a problem. I nee...</title><content type='html'>Hi Steve,&lt;br /&gt;&lt;br /&gt;  Nice tip, but I have a problem. I need to do sort using 2 fields. I try to put other &amp;quot;DisplayColumn&amp;quot;. Do you know, how I can do that ?&lt;br /&gt;&lt;br /&gt;Thanks</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/6697401717789404302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/6697401717789404302'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1300991476231#c6697401717789404302' title=''/><author><name>Yuri</name><uri>http://www.blogger.com/profile/18368917593547953867</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1891523458'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-7009150404021208717</id><published>2010-11-22T17:04:13.006Z</published><updated>2010-11-22T17:04:13.006Z</updated><title type='text'>Good point fabiocanada :)

Steve</title><content type='html'>Good point fabiocanada :)&lt;br /&gt;&lt;br /&gt;Steve</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/7009150404021208717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/7009150404021208717'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1290445453006#c7009150404021208717' title=''/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1202627566'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-8204991639780204848</id><published>2010-11-22T16:51:42.492Z</published><updated>2010-11-22T16:51:42.492Z</updated><title type='text'>The code works! But it&amp;#39;s better top use it onl...</title><content type='html'>The code works! But it&amp;#39;s better top use it only when the page is not a post back. I was able to delete and re-order.&lt;br /&gt;&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    if (!IsPostBack)&lt;br /&gt;    {&lt;br /&gt;        var displayColumn = table.Attributes.OfType().FirstOrDefault();&lt;br /&gt;        if (displayColumn != null &amp;amp;&amp;amp; displayColumn.SortColumn != null)&lt;br /&gt;        {&lt;br /&gt;            GridView1.Sort(displayColumn.SortColumn,&lt;br /&gt;                displayColumn.SortDescending ? SortDirection.Descending : SortDirection.Ascending);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8204991639780204848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8204991639780204848'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1290444702492#c8204991639780204848' title=''/><author><name>fabiocanada</name><uri>http://fabiocanada.ca/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/openid16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1644981949'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-8431479852078185108</id><published>2010-04-27T16:57:14.177+01:00</published><updated>2010-04-27T16:57:14.177+01:00</updated><title type='text'>Thanks fabriciofuji :)

Steve</title><content type='html'>Thanks fabriciofuji :)&lt;br /&gt;&lt;br /&gt;Steve</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8431479852078185108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8431479852078185108'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1272383834177#c8431479852078185108' title=''/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1202627566'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-2914484969858214113</id><published>2010-04-27T16:24:40.251+01:00</published><updated>2010-04-27T16:24:40.251+01:00</updated><title type='text'>Worked perfectly! Thanks.</title><content type='html'>Worked perfectly! Thanks.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/2914484969858214113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/2914484969858214113'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1272381880251#c2914484969858214113' title=''/><author><name>fabriciofuji</name><uri>http://www.blogger.com/profile/12926865512420361890</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1797651065'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-6901649690323601022</id><published>2010-02-10T11:18:28.296Z</published><updated>2010-02-10T11:18:28.296Z</updated><title type='text'>Thanks again for this - solved my problem!</title><content type='html'>Thanks again for this - solved my problem!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/6901649690323601022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/6901649690323601022'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1265800708296#c6901649690323601022' title=''/><author><name>Gareth Thomas Hill</name><uri>http://www.blogger.com/profile/13811920704142646474</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-77953463'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-1405449521385232092</id><published>2009-11-16T09:47:59.707Z</published><updated>2009-11-16T09:47:59.707Z</updated><title type='text'>Hi Stuart, thanks for that, I&amp;#39;ll do an update ...</title><content type='html'>Hi Stuart, thanks for that, I&amp;#39;ll do an update and cite you for that snippet, do you have a blog or website I can point to in the citation?&lt;br /&gt;&lt;br /&gt;Steve :D</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/1405449521385232092'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/1405449521385232092'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1258364879707#c1405449521385232092' title=''/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1202627566'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-2975159287922826920</id><published>2009-11-16T08:21:32.945Z</published><updated>2009-11-16T08:21:32.945Z</updated><title type='text'>not much help for a newbie...</title><content type='html'>not much help for a newbie...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/2975159287922826920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/2975159287922826920'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1258359692945#c2975159287922826920' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1287075642'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-8224837427735874986</id><published>2009-07-20T20:59:16.241+01:00</published><updated>2009-07-20T20:59:16.241+01:00</updated><title type='text'>Steve,

Instead of sorting on the GridView, I set ...</title><content type='html'>Steve,&lt;br /&gt;&lt;br /&gt;Instead of sorting on the GridView, I set the OrderBy property of the underlying LinqDataSource in The Page_Load method and that seems to resolve the deleting and paging issues.&lt;br /&gt;&lt;br /&gt;[code]&lt;br /&gt;string orderBy = string.Format(&amp;quot;{0} {1}&amp;quot;, displayColumn.SortColumn, displayColumn.SortDescending ? &amp;quot;descending&amp;quot; : &amp;quot;ascending&amp;quot;);&lt;br /&gt;GridDataSource.OrderBy = orderBy;&lt;br /&gt;[/code]</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8224837427735874986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/8224837427735874986'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1248119956241#c8224837427735874986' title=''/><author><name>Stuart Whiteford</name><uri>http://blog.stuartwhiteford.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-669904377'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-6679076540388682417</id><published>2009-07-20T20:04:43.879+01:00</published><updated>2009-07-20T20:04:43.879+01:00</updated><title type='text'>Yep, deletes don&amp;#39;t work for me too. Also notic...</title><content type='html'>Yep, deletes don&amp;#39;t work for me too. Also noticed that I can only navigate up to page 2 with the GridViewPager.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/6679076540388682417'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/6679076540388682417'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1248116683879#c6679076540388682417' title=''/><author><name>Stuart Whiteford</name><uri>http://blog.stuartwhiteford.com/</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-669904377'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-1554775504872268419</id><published>2009-06-16T12:01:55.059+01:00</published><updated>2009-06-16T12:01:55.059+01:00</updated><title type='text'>I&amp;#39;ll give that a test and get back to you on t...</title><content type='html'>I&amp;#39;ll give that a test and get back to you on this, I think only tested this with DD.&lt;br /&gt;&lt;br /&gt;Steve :D</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/1554775504872268419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/1554775504872268419'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1245150115059#c1554775504872268419' title=''/><author><name>Steve</name><uri>http://www.blogger.com/profile/17435527974910745156</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://bp1.blogger.com/_UUHjb9DZhJM/SDtH0AxIZOI/AAAAAAAAAEM/TFDI9vas7Sc/S220/Me+63x80.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1202627566'/></entry><entry><id>tag:blogger.com,1999:blog-6907873803403737979.post-7935640340627227028</id><published>2009-06-16T10:48:44.190+01:00</published><updated>2009-06-16T10:48:44.190+01:00</updated><title type='text'>Using this method, deletes don&amp;#39;t work anymore....</title><content type='html'>Using this method, deletes don&amp;#39;t work anymore...</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/7935640340627227028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6907873803403737979/8759535853052018020/comments/default/7935640340627227028'/><link rel='alternate' type='text/html' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html?showComment=1245145724190#c7935640340627227028' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://csharpbits.notaclue.net/2009/01/setting-initial-sort-order-dynamic-data.html' ref='tag:blogger.com,1999:blog-6907873803403737979.post-8759535853052018020' source='http://www.blogger.com/feeds/6907873803403737979/posts/default/8759535853052018020' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-361896177'/></entry></feed>
