sorting

DataTable must be set prior to using DataView.

When i try to sort my table manually, i receive this error: DataTable must be set prior to using DataView. The code is: protected void GridView1_Sorting(object sender, GridViewSortEventArgs e) { DataTable sourceTable = GridView1.DataSource as DataTable; DataView view = new DataView(sourceTable); string[] sor...

C# DataBinded ListBoxes - Sorting Issue

I have these ListBox es.. all of them are DataBind ed to same table and they are in a table type of manner, every row corresponds to its actual value in the datbase. When i switch selection(SelectedIndexChange) on any of these ListBoxes i change the SelectedIndex of all the other ListBox es. Now i cannot simply select "Sort = true" f...

LINQ to Entites/IQueryable: Sorting on multiple fields

I have the following that I'd like to sort: IQueryable<Map> list; list = from item in ctx.MAP .Include("C") .Include("L") .Include("L.DP") select item; return list.OrderBy(m=>(m.L.DP.Name + m.L.Code)); This works, but it sorts alphabetically - so 12 comes before 9. (Assume Code is a num...

What's the best way to manipulate the way entries in a data base are displayed on my web page?

I have a client I am building a small CMS for. One of the functions is that he would like to be able to pick the order in which images display on a page. In my mySql Database I have a table called image_info with the fields: index (auto incremented) img_url img_link I was thinking of adding an additional field called img_order whic...

Django admin: how to sort by one of the custom list_display fields that has no database field

# admin.py class CustomerAdmin(admin.ModelAdmin): list_display = ('foo', 'number_of_orders') # models.py class Order(models.Model): bar = models.CharField[...] customer = models.ForeignKey(Customer) class Customer(models.Model): foo = models.CharField[...] def number_of_orders(self): return u'%s' % Order.o...

Selection Sort Help

Hi I was wondering that if you had an array of integers, how you would use sort it using selection sort in descending order. I know how to do it in ascending order but I don't know how to do in it descending order. Thanks! ...

Silverlight 3 DataGrid (w/ PagedCollectionView) RowGroupHeaderStyles not reapplied on sort

I am trying to use a DataGrid with hidden group row headers (so that there is a sort boundary). My style simply sets the visibility to collapsed (and I also am setting the SublevelIndent to 0 during the LoadingGroup event). Initial display is exactly what I want, but the data grid is sorted the appearance is unstyled, and the default ...

radix sort on binary strings with arbitrary length

hi, i googled around and see lots of discussion about radix sort on binary string, but they are all with same lenght, how aobut binary string with arbitrary lenght? say i have {"001", "10101", "011010", "10", "111"}, how do i do radix sort on them ? Thanks! ...

Why (dictionary.keys()).sort() is not working in python ?

Hi, I'm new to Python and can't understand why a thing like this does not work. I can't find the issue raised elsewhere either. toto = {'a':1, 'c':2 , 'b':3} toto.keys().sort() #does not work (yields none) (toto.keys()).sort() #does not work (yields none) eval('toto.keys()').sort() #does not work (yields none) Yet...

Tricky number sorting question in Java. How to sort ascending using if's?

So I am in a Java class in school, and I have a relatively simple assignment that I just can't figure out. It's not a problem to research the answer, so I am throwing it out to the brightest people out there. My simple java program takes 4 numbers as input, and then it is just supposed to spit those numbers right back out, but in order s...

How can I get TStringList to sort differently in Delphi

I have a simple TStringList. I do a TStringList.Sort on it. Then I notice that the underscore "_" sorts before the capital letter "A". This was in contrast to a third party package that was sorting the same text and sorted _ after A. According to the ANSI character set, A-Z are characters 65 - 90 and _ is 95. So it looks like the 3rd ...

mysql custom sort

hello, I have a query like this: SELECT * FROM table WHERE id IN (2,4,1,5,3); However, when I print it out, it's automatically sorted 1,2,3,4,5. How can we maintain the order (2,4,1,5,3) without changing the database structure? Thanks! ...

PHP Get element with 5 highest occurrence in an array

Something similar to this: http://stackoverflow.com/questions/1053843/get-element-with-highest-occurrence-in-an-array Difference is I need more than 1 result, need 5 results altogether. So the 5 top highest occurence in a (large) array. Thanks! ...

How to sort numerically, instead of by string, on a telerik RadGrid Asp.Net Ajax?

I have a RadGrid that has a Loss Amount column which I would like to be able to sort. Currently it does sort, but only by string value. I have the column type as GridNumericColumn. Can someone point me in the right direction please? Thanks in advance. Update: Ok, here's my code. I am also formatting the column text to show the currency...

In python, sorting on date field, field may sometimes be null

I am having a hard time coming up with a slick way to handle this sort. I have data coming back from a database read. I want to sort on the accoutingdate. However, accoutingdate may sometimes be null. I am currently doing the following: results = sorted(results, key=operator.itemgetter('accountingdate'), reverse=True) But, this bo...

searching an unorder list without converting it to an array

Is there a way to first sort then search for an objects within a linked list of objects. I thought just to you one of the sorting way and a binary search what do you think? Thanks ...

please help me in creating a sort expressions for datatable in vb.net

I have got a datatable which contains many columns in which three are main: hotelid dshotelid hotelname Some hotels contain only dshotelid, some contains only hotelid and some contain both dshotelid and hotelid. I need sort in such way so that those hotels who got both dshotelid and hotelid should be on top and then those hotels who...

Database Records Sorting

is there any query that would go n sort recods in the data-base via any column. I don't want the a "Ordered Result". i want the stored records rearranged and sorted. ...

Sorting a multi-dimensional [,] array in C#, composed of integers

I have the following array: private int[,] testSamples = new testSamples[101,101]; It's supposed to represent a roster, with column 0 to 100 and row 0 to 100. In this rosters, various chemical liquids are dropped. The person I'm doing this for wants to work in such a way that he can take care of the container with the most liquid in i...

How to sort array in javascript?

var arr = []; arr.push(row1); arr.push(row2); ... arr.push(rown); How to sort by row['key']? ...