Bound WebCombo with Data Object as Value

1 reply. Last post: April 15, 2010 3:06 AM by Glenn Layaar
Tags :
  • (None)
a aMember

Hi

I have a Webcombo that is bound to an ObjectDataSource which returns a collection of a dataset. for example of the type Person. Here's a snippet:

    public class Person
{
private Guid personId;
private string lastname;

[DataMember]
public Guid Id
{
get { return personId; }
protected set { personId = value; }

[DataMember]
public string Lastname
{
get { return lastname; }
set { lastname = value; }
}

}

The ObjectDataSource retrieves a list of Persons with a WCF-Service:

public IList<Person> GetPersons();


When I bind a WebCombo to the DataSource I can select the Display Member (Property Lastname in my case) and the Value Member, which can be retrieved with myWebCombo.Text and myWebCombo.Value. For these I can only chose from the properties of my Data Objects (Lastname and Id) but I want the Value to be the data object itself (i.e the Person instance). Is this possible?

If not, is it anyhow possible to get the bound data object over myWebCombo.<GetTheBoundDataObject>?

Thanks

Answers

Currently it is not possible to get the reference to LINQ object from WebCombo.

If you need to lookup another column which is not defined in the Text or Value property you could try using the Rows property of WebCombo, however this will return a DataRow object.

Attached is a simple demonstration of such technique.

All Replies

Currently it is not possible to get the reference to LINQ object from WebCombo.

If you need to lookup another column which is not defined in the Text or Value property you could try using the Rows property of WebCombo, however this will return a DataRow object.

Attached is a simple demonstration of such technique.

All times are GMT -5. The time now is 2:37 PM.
Previous Next