Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combobox data binding
Message
De
04/03/2005 10:26:24
 
 
À
04/03/2005 10:05:12
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Versions des environnements
Environment:
C# 1.1
OS:
Windows XP SP2
Network:
Windows NT
Database:
MS SQL Server
Divers
Thread ID:
00992721
Message ID:
00992733
Vues:
20
Thanks Kevin, but my combobox is still empty. Here's my latest code I tested, but without success:
SqlConnection conn = new SqlConnection (ConfigurationSettings.AppSettings["ConnectionString"]);
DataSet dsTable = new DataSet ();
SqlDataAdapter adptTable = new SqlDataAdapter ("select * from client", conn);
adptTable.Fill (dsTable, "Client");
cboClient.DisplayMember = "Client";
cboClient.ValueMember = "PK_Client";
cboClient.DataSource = dsTable.Tables["Client"];
cboClient.DataBindings.Add ("SelectedValue", dsTable.Tables["Client"], "PK_Client");
>I think you're close...I believe you need one more line at the end, to actually bind/map a property of the combobox to the datatable.
>cboClient.DataBindings.Add("SelectedValue",dtClient, ,"PK_Client");
>This way, what's in the combo's SelectedValue (associated with ValueMember) will be mapped to PK_Client.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform