473,396 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Arraylist binding

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 ?

--
Best Regards

The Inimitable Mr Newbie º¿º
Dec 5 '05 #1
3 917
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" wrote:
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 ?

--
Best Regards

The Inimitable Mr Newbie º¿º

Dec 5 '05 #2
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
Dec 6 '05 #3
:-D

Masochist ?, No,

--
Best Regards

The Inimitable Mr Newbie º¿º
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
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

Dec 6 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Jason | last post by:
Here is an odd issue. I am trying to shed some light on why this is causing a problem. I have an ArrayList. I am binding it to a ListBox control with has its Sort property set to True. If the...
7
by: Alex Ting | last post by:
Hi Everybody, I have an issue about deleting an object from an arrayList. I've bounded a datagrid using this code where it will first run through all of the code in loadQuestions() and bind a...
0
by: berg | last post by:
All, I am binding an ArrayList full of custom objects to an DataGrid. The property in the custom class are all public. I define a DataGridTableStyle and set the MappingName to "ArrayList". I...
2
by: kids_pro | last post by:
I created a simple Person class as following: class Person{ private string fname; private string lname; public Person(string fname, string lname){ this.fname = fname; this.lname = lname; }
2
by: VB Programmer | last post by:
I have an arraylist which holds a custom structure I made. (The structure contains FirstName, LastName, Address and EmpId.) I am trying to loop through the arraylist to write out each item. ...
4
by: Alan Silver | last post by:
Hello, I'm trying to use an ArrayList to do data binding, but am getting an error I don't understand. I posted this in another thread, but that was all confused with various other problems,...
12
by: Sueffel | last post by:
I'm having problems with this one: I have a tructure that is being added to an arraylist, so I may have 15 of these structure objects in an arraylist. now, what I want to do is this: dim TT as...
5
by: Rami | last post by:
Hey, I Tried to bind a DataGrid to an ArrayList, and had 2 problems: 1. The DataGrid shows the Length property of the items instead of their text - how can I change that? 2. After binding, I add...
16
by: Michael C# | last post by:
I'm binding a Combobox to an Arraylist, and I'd like to set the ValueMember and DisplayMember properties of the Combobox. Is this possible, or do I need to bind to a DataTable? Thanks
3
by: weird0 | last post by:
Purpose: The objective is to update or add a new row in datagridview using an arraylist I have an arraylist inside of a class and i added an object to the arraylist on the button click event....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.