Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binding to DataTable in object
Message
From
26/09/2007 11:54:35
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Binding to DataTable in object
Miscellaneous
Thread ID:
01256939
Message ID:
01256939
Views:
70
UPDATE: Forget it. DataTable wasn't created at binding time. Just needed a bs.ResetBindings() after the table was available......

Hi,
In essence:
public class X
{
   public DataTable dt;
   public BindingList<Test> y;  
}

public class Test {public string Name;}

BindingSource bs = new BindingSource();
bs.DataSource = AnInstanceOfX;
cbo1.DataSource = bs;
cbo1.DataMember = "y.Name"
cbo2.DataSource= bs;
cbo2.DataMember = "dt.Name" // Name is a column
The first binding works, the second does not. Why?
FWIW if don't use the BindingSource it works. i.e:
cbo2.DataSource = AnInstanceOfX;
cbo2.DataMember = "dt.Name";
(P.S. this isn't actual code - just a simplified version of the problem)
Reply
Map
View

Click here to load this message in the networking platform