- Home
- Forum
- ASP.NET Web Forms (Classic)
- List<T> as DataSource
List<T> as DataSource
- Jun 2, 2010 08:44 PM UTC
- Jun 10, 2010 03:29 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;
l.Add(c);
return l;
}
but it doesn't work: ValueMember shown - not DisplayMember. Do i miss some parameter or something? Please, help me fix the code.
public class MyClass
{
public string Name {get;set;}
public int CustID {get;set;}
}
private List
{
List
MyClass c =new MyClass();
c.Name = "Name1";
c.CustID = 1;
l.Add(c);
return l;
}
but it doesn't work: ValueMember shown - not DisplayMember. Do i miss some parameter or something? Please, help me fix the code.
SIGN IN To post a reply.
4 Replies
AA
Arulraj A
Syncfusion Team
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.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDBG_Pk_Fk-589013590.zip
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.
Regards,
Arulraj.A
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.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDBG_Pk_Fk-589013590.zip
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.
Regards,
Arulraj.A
LP
Lena Prys
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?
LP
Lena Prys
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.
NR
Nirmal Raja
Syncfusion Team
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:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDBG_Pk_Fk493623130.zip
Let me know if you have any queries.
Regards,
Nirmal
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:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDBG_Pk_Fk493623130.zip
Let me know if you have any queries.
Regards,
Nirmal
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
LP Lena Prys
- Jun 2, 2010 08:44 PM UTC
- Jun 10, 2010 03:29 PM UTC