Arraylist binding

  • Thread starter Thread starter Mr Newbie
  • Start date Start date
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 ?
 
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
 
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
 
Back
Top