Data Binding ArrayList

sisamiscolf

New Member
I'm trying to do something I think should be possible, I just don't know how to implement it.<BR><BR>I found out you can bind an asp:dropdown to a datasource.<BR><BR>That Datasource can be an ArrayList.<BR><BR>so MyDropDown.DataSource = MyArrayList; is perfectly legal.<BR><BR>However, my problem is that I happen to have an object inside MyArrayList. (Basically an ArrayList of Objects). This Object has two properties (.Name .Value). How can I get this to bind to the asp:dropdown?<BR><BR>I basically want to bind <BR><BR>[something like this code: DropDown1.DataTextField = MyArrayList[0].MyObject.Name ]<BR> <BR><BR>and <BR><BR>[DropDown1.DataValueField = MyArrayList[0].MyObject.Value]<BR><BR>Obviously this won't work since it needs to loop.<BR><BR>Anybody done this, can help, please.<BR>Thanks,<BR>Arty<BR><BR><BR>Okay so I'm a retard.<BR><BR>all you do is:<BR><BR>DropDownList1.DataTextField = "Name";<BR><BR>You provide a string of your get property. Thats it. How in the hell it implements this is still rather a mystery. But I know it works, in case anyone was interested how it got resolved.seems like we are both talking to ourselves today - I think I am the bigger retard though :)
 
Back
Top