Binding ArrayList of Custom objects to DropDownList

H

Holysmoke

Hi,

I trying to bind an ArrayList which contains objects from a custom class.

I get an error 'DataBinder.Eval:
'BookBuilding.ServiceAuthApplications.CabUser' does not contain a property
with the name DomainUserId.

The ArrayList of objects contains objects of CabUser class (my custom class).
If I remove DataTextField and DataValueField property,

I get a strange (probably the Type of my object)values in my DropDownList
instead of values.

I look forward for the workaround,

TIA,
Holy
 
R

Ryan Cromwell

Make sure you class contains properties not fields. DataBinding will only
interogate properties, not fields. For example:

private string _cabUser;
public string CabUser
{
get { return _cabUser; }
}

RATHER THAN

public string CabUser;
 

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

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top