Use the sortedList class to establish sorted DropDownList

xiaoxiao2021-03-06  95

Use the sortedList class to establish sorted DropDownList

Sortedlist

Class is similar to

Hashtable

with

ArrayList

Mixed mix. Like HashTable, sortedList is also based on

IDictionary

Interface; therefore, each element of sortedList is a key and value pair. SortedList provides a method that only returns a key list or only return value list. Like ArrayList, sortedList is an element sequence. It is indexed and is sorted according to a particular comparator. SortedList in all

Collectes

The class is unique, and each element can be accessed in three ways: use the key, value, or index.

Use sortedlist if you want a collection of saver / value pairs and requires the flexibility of the index list. -------------------------------------------------- ------------------------------------ Example:

SortedList SL

=

New

Sortedlist (); sl.Add (

"

Item

"

,

"

1

"

); Sl.add

"

Item 2

"

,

"

2

"

); Sl.add

"

Item three

"

,

"

3

"

); Sl.add

"

Item

"

,

"

4

"

);

//

Bind DROPDOWNLIST

DROPDOWNLIST1.DATASOSOURCE

=

SL; DropDownList1.DataValuefield

=

"

Value

"

DROPDOWNLIST1.DATATEXTFIELD

=

"

Key

"

DROPDOWNLIST1.DATABIND ();

转载请注明原文地址:https://www.9cbs.com/read-96751.html

New Post(0)