Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binding to DataTable in object
Message
De
26/09/2007 11:54:35
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Binding to DataTable in object
Divers
Thread ID:
01256939
Message ID:
01256939
Vues:
68
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)
Répondre
Fil
Voir

Click here to load this message in the networking platform