ASP Collection?

N

Noozer

On my ASP page I have a two dimentional array, three elements wide by a
variable number long. The first element is the data field of the source
data, the second element is a column name that is displayed to the user, the
last element is the width of the column when displayed to the user.

On this page I'm displaying a list of checkboxes and need to preload some of
these boxes based on the array. Unfortunately, the order of the checks and
the order of the array do not match. Also, many of the checkboxes won't
exist in the array at all.

It would be great if I could check to see if a particular value is held
anyplace in the first element of the array. I could do this with a for/next
loop, but that really isn't very efficient.

I'm pretty sure that I can do this with a dictionary object, but I can't see
how I could create a multi element dictionary object.

...
dim d
set d=Server.CreateObject("Scripting.Dictionary")
d.add "FirstName","First Name"
d.add "Surname","Last Name"
d.add "Sex","Gender"
response.write d.Exists("Surname") ' This will be true.
...

As you can see, I can use the 1st element as the key, since it will be
unique, and the 2nd element will be the value, but how can I also store the
width?
 
N

Noozer

Noozer said:
On my ASP page I have a two dimentional array, three elements wide by a
variable number long. The first element is the data field of the source
data, the second element is a column name that is displayed to the user, the
last element is the width of the column when displayed to the user.

<snip>

Actually, I've reworked my page to use multiple scripting dictionary objects
for a much better solution.
 
D

dingbat

Noozer said:
Actually, I've reworked my page to use multiple scripting dictionary objects
for a much better solution.

Even better would be to use JavaScript (or even PerlScript). Having to
swallow the overhead of Scripting.Dictionary objects for such a trivial
task is a bad solution as a choice of tools, no matter how you then
proceed to code it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,219
Latest member
KristieKoh

Latest Threads

Top