Arraylist binding

M

Mr Newbie

Just curious here. Lets say I have objects stored in an ArrayList which are
instantiated using this class.

Public Class MyClass

Public myText as String
Public myValue as String

End Class

How would I bind this to a dropdownlist in ASP.NET so that the individual
text and value properties of this stored object were bound to the DropDown ?
is it possible ?
 
G

Guest

Mr Newbie,

I'm pretty sure that databinding only works with properties, not fields.

Instead of public fields, you will need public properties with private
variables to hold the data.

Kerry Moorman
 
C

Cor Ligthert [MVP]

Mr Newbie,

Are you a masochist, this works so easy with a datatable. (Using the
defaultview).

You are not the first one who want to do it with an arraylist, I have seen
some of them been buys weeks in this newsgroup to get it working. (And than
ended mostly at a place when the arraylist had to be showed in a sorted way
what is standard in the datatable.defaultview). However I have seen one who
did it until the end. (You can search this newsgroup for that).

Before you misunderstood me, it is not to difficult with an arraylist if you
know how to do it.

I hope this gives an idea.

Cor
 

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

Top