Just curious but why not create a class/struct that represents the data for
each item and stuff them into an ArrayList, and bind the array list to the
control in the scanrio you mention.
I can post an example for those interested.
Scott Worley
Author: Inside ASP.NET, Newriders Publishing
----- Original Message -----
From: "Dan" <dllist@c...>
To: "ASPX_Professional" <aspx_professional@p...>
Sent: Wednesday, October 30, 2002 4:20 AM
Subject: [aspx_professional] Re: Sorting based on values not key in a
SortedList
> Thanks for the suggestion I think I am going to have to store multiple
> lists, one for the values and one for the Guids. I have now discarded
> the SortedList.
>
> Dan Loverock
> Systems Developer
> Capecom Media Inc.
>
> -----Original Message-----
> From: Imar Spaanjaars [mailto:Imar@S...]
> Sent: Tuesday, October 29, 2002 9:28 AM
> To: ASPX_Professional
> Subject: [aspx_professional] Re: Sorting based on values not key in a
> SortedList
>
> Aha, I see now. Sorry I overlooked the SortedList. I thought you
> referred
> to just a Sorted List.
>
> AFAIK, a SortedList is always sorted on its keys, so it looks like you
> have the wrong tool for the job.
> Why not use a different Collection object, or better yet, bind the drop
> down directly to something like a DataSet or a Reader....?
>
>
> Imar
>
>
>
> At 08:31 AM 10/29/2002 -0800, you wrote:
> >The city information is coming from a stored procedure but as soon as
> it
> >is added into the SortedList the collection is ordered by the Guid
> >(Key). Which it needs to be added in with the Guid as its key so that I
> >am able to retrieve the City object by the Guid (Key).
> >
> >Dan Loverock
> >Systems Developer
> >Capecom Media Inc.
> >
> >-----Original Message-----
> >From: Imar Spaanjaars [mailto:Imar@S...]
> >Sent: Tuesday, October 29, 2002 7:56 AM
> >To: ASPX_Professional
> >Subject: [aspx_professional] Re: Sorting based on values not key in a
> >SortedList
> >
> >Where does your list of cities come from? From a query / stored
> >procedure?
> >In that case, add an ORDER BY clause to the SQL statement:
> >
> >SELECT GUID City FROM Cities ORDER BY City ASC
> >
> >The ASC, ascending, is not really necessary but clarifies your
> >intentions.
> >
> >Otherwise, store your cities in an array and sort that. Requires a bit
> >more
> >work but it should work as well.
> >
> >HtH,
> >
> >Imar
> >
> >
> >
> >
> >At 07:47 AM 10/29/2002 -0800, you wrote:
> > >I have run into a very interesting yet tricky question. I have a
> > >SortedList that stores information about cities. As the key I store
> the
> > >Guid from the database and as the value I store the name of the city.
> > >Now the true challenge is that when I bind it to a drop down list
> they
> > >are not in the order by name because they have been ordered by key. I
> > >want it to be ordered by value (City Name) and at the same time
> > >remaining the functionality of retrieving the cities by there key.
> Does
> > >anyone have any suggestions on how to order this SortedList by
> value??
> > >
> > >Any help is much appreciated
> > >
> > >Dan Loverock
> > >Systems Developer
> > >Capecom Media Inc.
> >
> >
> >
> >---
> >
> >ASP.NET 1.0 Namespace Reference with C#
> >http://www.wrox.com/acon11.asp?ISBN=1861007442
> >
> >ASP.NET 1.0 Namespace Reference with VB.NET
> >http://www.wrox.com/acon11.asp?ISBN=1861007450
> >
> >These books are a complete reference to the ASP.NET namespaces
> >for developers who are already familiar with using ASP.NET.
> >There is no trivial introductory material or useless .NET
> >hype and the presentation of the namespaces, in an easy-to use
> >alphabetical order ensures a user-friendly reference format.
> >We provide in-depth coverage of all the major ASP.NET classes,
> >giving you those real-world tips that the documentation doesn't
> >offer, and demonstrating complex techniques with simple
> >examples.
> >
> >---
> >
> >
> >
> >---
> >
> >ASP.NET 1.0 Namespace Reference with C#
> >http://www.wrox.com/acon11.asp?ISBN=1861007442
> >
> >ASP.NET 1.0 Namespace Reference with VB.NET
> >http://www.wrox.com/acon11.asp?ISBN=1861007450
> >
> >These books are a complete reference to the ASP.NET namespaces
> >for developers who are already familiar with using ASP.NET.
> >There is no trivial introductory material or useless .NET
> >hype and the presentation of the namespaces, in an easy-to use
> >alphabetical order ensures a user-friendly reference format.
> >We provide in-depth coverage of all the major ASP.NET classes,
> >giving you those real-world tips that the documentation doesn't
> >offer, and demonstrating complex techniques with simple
> >examples.
> >
> >---
>
>
>
> ---
>
> ASP.NET 1.0 Namespace Reference with C#
> http://www.wrox.com/acon11.asp?ISBN=1861007442
>
> ASP.NET 1.0 Namespace Reference with VB.NET
> http://www.wrox.com/acon11.asp?ISBN=1861007450
>
> These books are a complete reference to the ASP.NET namespaces
> for developers who are already familiar with using ASP.NET.
> There is no trivial introductory material or useless .NET
> hype and the presentation of the namespaces, in an easy-to use
> alphabetical order ensures a user-friendly reference format.
> We provide in-depth coverage of all the major ASP.NET classes,
> giving you those real-world tips that the documentation doesn't
> offer, and demonstrating complex techniques with simple
> examples.
>
> ---
>
>
>
> ---
>
> ASP.NET 1.0 Namespace Reference with C#
> http://www.wrox.com/acon11.asp?ISBN=1861007442
>
> ASP.NET 1.0 Namespace Reference with VB.NET
> http://www.wrox.com/acon11.asp?ISBN=1861007450
>
> These books are a complete reference to the ASP.NET namespaces
> for developers who are already familiar with using ASP.NET.
> There is no trivial introductory material or useless .NET
> hype and the presentation of the namespaces, in an easy-to use
> alphabetical order ensures a user-friendly reference format.
> We provide in-depth coverage of all the major ASP.NET classes,
> giving you those real-world tips that the documentation doesn't
> offer, and demonstrating complex techniques with simple
> examples.
>
> ---
>