We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

List<T> as DataSource

Thread ID:





94810 Jun 2,2010 08:44 PM UTC Jun 10,2010 03:29 PM UTC ASP.NET Web Forms (Classic) 4
Tags: GridGroupingControl
Lena Prys
Asked On June 2, 2010 08:44 PM UTC

Hello, I'm trying to modify example from http://help.syncfusion.com/ug_64/gridwin/ForeignKeyColumnsShowingOneValueButSavingAnother.html so ForeignKeyTable() method returns List and looks something like this

public class MyClass
public string Name {get;set;}
public int CustID {get;set;}

private List ForeignKeyTable()
List l = new List();
MyClass c =new MyClass();
c.Name = "Name1";
c.CustID = 1;
return l;

but it doesn't work: ValueMember shown - not DisplayMember. Do i miss some parameter or something? Please, help me fix the code.

Arulraj A [Syncfusion]
Replied On June 4, 2010 02:27 PM UTC

Hi Herta,

Thanks for your interest in Syncfusion Products.

We have modified the sample with the code you provided and found working. Here it has been attached for your reference.

The column displays the DisplayMember set by default. If there is no display member for a particular item, then ValueMember get displayed for that one. With the code provided, 1 is set with Name1. If the field holds other than 1, but no corresponding values, then corresponding ValueMember will be displayed.

Please let me know if you have any further concerns.


Lena Prys
Replied On June 4, 2010 03:48 PM UTC

Thank you for the answer. Now, when I've looked closer to my project, I've noticed that it is not exactly the same as example by the link. In my project I use gridControl - not gridDataBoundGrid. So it works when I set as column dataSource DataTable and doesn't work(ValueMember shown) for List. Any special parameters for gridControl?

Lena Prys
Replied On June 10, 2010 12:23 PM UTC

The question is closed. GridControl also can take list as datasource without any problems. My problem was in custom GridGenericControlCellRenderer.

Nirmal Raja [Syncfusion]
Replied On June 10, 2010 03:29 PM UTC

Hi Lena,

The GridControl is cell oriented and it does not assignd with the data source. You can just populate the values to the grid cell using the PopulateValues method.

I have attached the sample with a grid control loads data from the data table. Please provide us or modify this sample such that your requirement of setting data source from the list to the grid control.

The sample has been attached in the below location:

Let me know if you have any queries.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon