Sorting DataGrid
-
Hello, How can I sort a DataGridColumn which has Alphanumeric values such that "Record No: x". Is there any property which I can use for this purpose. Scenario: I have 4 values in column R1, R9, R20,R10 and when I try to sort this column in the DataGrid (by clicking the header) it displays R1, R10, R20, R9. While I want to display R1, R9, R10, R20. Is is possible. Thanks in advance Maqsood Ahmed Kolachi Advanced Technologies http://www.kolachi.net
-
Hello, How can I sort a DataGridColumn which has Alphanumeric values such that "Record No: x". Is there any property which I can use for this purpose. Scenario: I have 4 values in column R1, R9, R20,R10 and when I try to sort this column in the DataGrid (by clicking the header) it displays R1, R10, R20, R9. While I want to display R1, R9, R10, R20. Is is possible. Thanks in advance Maqsood Ahmed Kolachi Advanced Technologies http://www.kolachi.net
Would it be possible to pad the numeric portions with zeros? That should yield a more "accurate" sort.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
-
Would it be possible to pad the numeric portions with zeros? That should yield a more "accurate" sort.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
turbochimp wrote: Would it be possible to pad the numeric portions with zeros? Hello, No! the given scenario was just to make the problem clearer. I have sort more complex values in the realtime application, something like "Buy Price 1.2034", "Sell Price 2.382", "Market Price" etc. It means that some values can be alphanumeric but others will be just strings. Can anyone suggest a generic solution to this problem. Bye :) Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net
-
turbochimp wrote: Would it be possible to pad the numeric portions with zeros? Hello, No! the given scenario was just to make the problem clearer. I have sort more complex values in the realtime application, something like "Buy Price 1.2034", "Sell Price 2.382", "Market Price" etc. It means that some values can be alphanumeric but others will be just strings. Can anyone suggest a generic solution to this problem. Bye :) Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net
It sounds like you need normalization, not a different sort routine. In the example you offer, there should be 3 columns - BuyPrice (decimal), SellPrice (decimal) and MarketPrice (decimal). If you're using a single column to hold three different pieces of data, you should think about changing the way the data is stored and/or displayed.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
-
It sounds like you need normalization, not a different sort routine. In the example you offer, there should be 3 columns - BuyPrice (decimal), SellPrice (decimal) and MarketPrice (decimal). If you're using a single column to hold three different pieces of data, you should think about changing the way the data is stored and/or displayed.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
Hello, It is not the case of storing data in right way or something, it is just for the user friendliness, the way user wants to see it. By the way, there should be only two columns, Price and Type :). Any luck with the actual problem :s Cheers. Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net
-
Hello, It is not the case of storing data in right way or something, it is just for the user friendliness, the way user wants to see it. By the way, there should be only two columns, Price and Type :). Any luck with the actual problem :s Cheers. Maqsood Ahmed [MCP,C#] Kolachi Advanced Technologies http://www.kolachi.net
You can always display normalized data in a non-normalized way using SQL functions, string concatenation or by simple control placement. How you display data to the user should not dictate your data model. They seldom coincide. In the example you provided, you would need three columns to hold price information unless you decided to either duplicate all row data for each price type, or move prices to a separate table. One price column in the same table would not cut it. As far as "the actual problem", there isn't one. You're trying to use standard sort routines to sort data in a non-standard way; what's more, your data appears to be stored in a fashion that is not conducive to ever having meaningful reporting or display filtering options. If you are completely devoted to storing your data in the manner you suggest, then I would advise investing some time learning how to implement the IComparable interface, and create your own collection class that's sortable. Please note that this option is less than optimal, to put it mildly.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’